Skip to content

Commit 15f9afb

Browse files
committed
[bug] put user site package numpy include before system numpy include
1 parent ab18109 commit 15f9afb

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Copyright: (C) Qianqian Fang (2020-2025) <q.fang at neu.edu>
66
- Copyright: (C) Iotic Labs Ltd. (2016-2019) <vilnis.termanis at iotic-labs.com>
77
- License: Apache License, Version 2.0
8-
- Version: 0.5.2
8+
- Version: 0.5.3
99
- URL: https://pypi.org/project/bjdata/
1010
- Github: https://github.com/NeuroJSON/pybj
1111
- BJData Spec Version: [V1 Draft 3](https://neurojson.org/bjdata/draft3)

bjdata/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616

17-
"""BJData (Draft 2) and UBJSON (Draft 12) implementation
17+
"""BJData (Draft 3) and UBJSON (Draft 12) implementation
1818
1919
Example usage:
2020
@@ -40,7 +40,7 @@
4040
from .encoder import EncoderException
4141
from .decoder import DecoderException
4242

43-
__version__ = "0.5.2"
43+
__version__ = "0.5.3"
4444

4545
__all__ = (
4646
"EXTENSION_ENABLED",

coverage_test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ rm -rf coverage/{c,python}
1111

1212
# Coverage should be measured with extension compiled for both Python 2 & 3 (e.g. via separate venv)
1313
export CFLAGS="-coverage"
14-
python setup.py build_ext -i
15-
python -mcoverage run --branch --omit=bjdata/compat.py -m unittest discover test/ -vf
16-
python -mcoverage html -d coverage/python
14+
python3 setup.py build_ext -i
15+
python3 -mcoverage run --branch --omit=bjdata/compat.py -m unittest discover test/ -vf
16+
python3 -mcoverage html -d coverage/python
1717
lcov --capture --directory . --output-file /tmp/bjdata-coverage.info.pre
1818
# Only consider own source files. (Unfortunately extract/remove commands seem incapable of reading from stdin)
1919
lcov --extract /tmp/bjdata-coverage.info.pre "$(pwd)/src/*" --output-file /tmp/bjdata-coverage.info.pre2

setup.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
import warnings
2121
from glob import glob
2222
from 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
2627
try:
@@ -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
4752
class 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

8186
setup(
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

Comments
 (0)