2020import warnings
2121from glob import glob
2222from platform import python_implementation
23- import numpy
23+ from site import getusersitepackages
24+ from numpy import get_include as numpy_get_include
2425
2526# Allow for environments without setuptools
2627try :
@@ -43,6 +44,10 @@ def load_description(filename):
4344 return infile .read ()
4445
4546
47+ user_site = getusersitepackages ()
48+ user_numpy_include = os .path .join (user_site , "numpy" , "core" , "include" )
49+
50+
4651# Loosely based on https://github.com/mongodb/mongo-python-driver/blob/master/setup.py
4752class BuildExtWarnOnFail (build_ext ):
4853 """Allow for extension building to fail."""
@@ -73,14 +78,14 @@ def build_extension(self, ext):
7378 "PYBJDATA_NO_EXTENSION" not in os .environ and python_implementation () != "PyPy"
7479)
7580
76- COMPILE_ARGS = ["-std=c99" , "-DUSE__BJDATA" ]
81+ COMPILE_ARGS = ["-std=c99" , "-DUSE__BJDATA" , "-v" ]
7782# For testing/debug only - some of these are GCC-specific
7883# COMPILE_ARGS += ['-Wall', '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual', '-Wstrict-prototypes',
7984# '-pedantic']
8085
8186setup (
8287 name = "bjdata" ,
83- version = "0.5.2 " ,
88+ version = "0.5.3 " ,
8489 description = "Binary JData and UBJSON encoder/decoder" ,
8590 long_description = load_description ("README.md" ),
8691 long_description_content_type = "text/markdown" ,
@@ -99,7 +104,7 @@ def build_extension(self, ext):
99104 Extension (
100105 "_bjdata" ,
101106 sorted (glob ("src/*.c" )),
102- include_dirs = [numpy . get_include ()],
107+ include_dirs = [user_numpy_include , numpy_get_include ()],
103108 extra_compile_args = COMPILE_ARGS ,
104109 # undef_macros=['NDEBUG']
105110 )
0 commit comments