diff options
author | Nao Pross <np@0hm.ch> | 2022-02-11 00:05:10 +0100 |
---|---|---|
committer | Jonas Schmid <schmid@stettbacher.ch> | 2022-02-11 07:36:49 +0100 |
commit | c6525d5bf37c5d6ddfd674d1690a8c4f2d9257d5 (patch) | |
tree | 1cd51fce8f0979d304ee34ea2f5bf127b5e63a6b /setup_c_extension.py | |
parent | Fix arrayobject.h path on Debian based distros (diff) | |
download | o3000-python-binding-c6525d5bf37c5d6ddfd674d1690a8c4f2d9257d5.tar.gz o3000-python-binding-c6525d5bf37c5d6ddfd674d1690a8c4f2d9257d5.zip |
Method to find arrayobject.h path on any distro
Improved solution to the issue described in commit
1cfdf5c198f1c74c2f894067baf4670f5bca8e70
The new solution should be more OS-independent.
Tested on MacOS 12.1 and Debian 10 Buster.
Signed-off-by: Jonas Schmid <schmid@stettbacher.ch>
Diffstat (limited to 'setup_c_extension.py')
-rw-r--r-- | setup_c_extension.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/setup_c_extension.py b/setup_c_extension.py index 9bed938..e01837f 100644 --- a/setup_c_extension.py +++ b/setup_c_extension.py @@ -1,24 +1,16 @@ from distutils.core import setup, Extension -extra_compile_args = [] - -# Detect if distribution is Ubuntu or Debian based -with open('/etc/os-release') as f: - lines = filter(None, f.read().split('\n')) - - info = {} - for (key, val) in map(lambda x: x.split('='), lines): - info[key] = val - - # The ID_LIKE key is usually a space separated list of OSes upon which the distribution is based. - if any(os in ('ubuntu', 'debian') for os in info['ID_LIKE'].split()): - extra_compile_args.append('-DDEBIAN_LINUX') +# Find where numpy is installed to get the header +import pathlib +import numpy +numpy_headers_path = pathlib.Path(numpy.__file__).parent.joinpath("core/include") setup(name = 'o3000', version = '1.0', ext_modules = [Extension( 'o3000', sources = ['c_extension.c', 'helpers.c'], - libraries = ['o3000','o3000_imgpipe','tiff'], - extra_compile_args = extra_compile_args # + ['-Wextra'] + libraries = ['o3000', 'o3000_imgpipe', 'tiff'], + include_dirs = [str(numpy_headers_path)], + # extra_compile_args = ['-Wextra'] )]) |