diff --git a/pyproject.toml b/pyproject.toml index 767d25b..77bd054 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,7 @@ requires = [ "setuptools_dso>=2.7a1,<=2.10; python_version<='3.11'", "setuptools_dso>=2.11a2; python_version>='3.12'", "wheel", - "numpy", - "numpy>=2.0.1; python_version>='3.10'", + "numpy>=1.7", "Cython>=0.20", "epicscorelibs==7.0.7.99.0.2; python_version<='3.11'", "epicscorelibs>=7.0.7.99.1.1a2; python_version>='3.12'", diff --git a/setup.py b/setup.py index 57af131..167aeaa 100755 --- a/setup.py +++ b/setup.py @@ -93,6 +93,20 @@ def get_numpy_include_dirs(): with open(os.path.join(os.path.dirname(__file__), 'README.md')) as F: long_description = F.read() +install_requires = [ + epicscorelibs.version.abi_requires(), + pvxslibs.version.abi_requires(), + 'nose2>=0.8.0', + 'ply', # for asLib +] + +if numpy.lib.NumpyVersion(numpy.__version__) >= '2.0.0b1': + install_requires += ['numpy >= 1.7', 'numpy < 3'] +else: + # assume ABI forward compatibility as indicated by + # https://github.com/numpy/numpy/blob/master/numpy/core/setup_common.py#L28 + install_requires += ['numpy >=%s'%numpy.version.short_version, 'numpy < 2'] + setup( name='p4p', version=package_version, @@ -131,15 +145,7 @@ def get_numpy_include_dirs(): package_dir={'':'src'}, package_data={'p4p': ['*.conf', '*.service']}, ext_modules = exts, - install_requires = [ - epicscorelibs.version.abi_requires(), - pvxslibs.version.abi_requires(), - # assume ABI forward compatibility as indicated by - # https://github.com/numpy/numpy/blob/master/numpy/core/setup_common.py#L28 - 'numpy >=%s'%numpy.version.short_version, - 'nose2>=0.8.0', - 'ply', # for asLib - ], + install_requires = install_requires, extras_require={ 'qt': ['qtpy'], }, diff --git a/src/p4p.h b/src/p4p.h index 6504706..330f1d4 100644 --- a/src/p4p.h +++ b/src/p4p.h @@ -43,6 +43,7 @@ // avoid numpy deprecation warnings when building with cython >= 3.0 #if CYTHON_HEX_VERSION>=0x03000000 # define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +# define NPY_TARGET_VERSION NPY_1_7_API_VERSION #endif namespace p4p {