aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c_extension.c13
-rw-r--r--setup_c_extension.py22
2 files changed, 8 insertions, 27 deletions
diff --git a/c_extension.c b/c_extension.c
index 6cfadba..7aebced 100644
--- a/c_extension.c
+++ b/c_extension.c
@@ -39,21 +39,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include <pthread.h>
#include <o3000/o3000.h>
#include <o3000/color_pipe.h>
+#include <numpy/arrayobject.h>
#include "helpers.h"
-/* On Debian Linux and its derivatives (such as ubuntu), Python libraries
- * installed through the package manager are kept in a non-standard directory
- * 'dist-packages' instead of 'site-packages'. Why? Who knows.
- *
- * https://wiki.debian.org/Python#Deviations_from_upstream
- */
-#ifdef DEBIAN_LINUX
- #include </usr/lib/python3/dist-packages/numpy/core/include/numpy/arrayobject.h>
-#else
- #include </usr/lib64/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h>
-#endif
-
#define DEFAULT_FRAME_RATE 10 ///< default frame rate
#define MAX_FRAME_WIDTH 1280 ///< O-3000 image width in pixels
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']
)])