mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-16 16:18:07 -07:00
This fixes a bug where the installed library is not importable on python 3.10 Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
73 lines
2.0 KiB
Diff
73 lines
2.0 KiB
Diff
diff --git a/setup.py b/setup.py
|
|
index 865544d..24fdc36 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -1,5 +1,6 @@
|
|
import os.path
|
|
import platform
|
|
+import itertools
|
|
|
|
from setuptools import setup, find_packages, Extension
|
|
|
|
@@ -17,11 +18,18 @@ with open(os.path.join(root, 'README.md'), 'rb') as readme:
|
|
|
|
system = platform.system()
|
|
|
|
+libraries = []
|
|
+extra_sources = []
|
|
extra_compile_args = []
|
|
|
|
if system == 'Darwin':
|
|
extra_compile_args.append('-std=c++11')
|
|
|
|
+if os.getenv('BUILD_WITH_SYSTEM_LIB'):
|
|
+ libraries.append('simdjson')
|
|
+else:
|
|
+ extra_sources.append('simdjson/simdjson.cpp')
|
|
+
|
|
if os.getenv('BUILD_WITH_CYTHON') and not CYTHON_AVAILABLE:
|
|
print(
|
|
'BUILD_WITH_CYTHON environment variable is set, but cython'
|
|
@@ -49,12 +57,15 @@ if os.getenv('BUILD_WITH_CYTHON') and CYTHON_AVAILABLE:
|
|
extensions = cythonize([
|
|
Extension(
|
|
'csimdjson',
|
|
- [
|
|
- 'simdjson/simdjson.cpp',
|
|
- 'simdjson/util.cpp',
|
|
- 'simdjson/csimdjson.pyx'
|
|
- ],
|
|
+ list(itertools.chain(
|
|
+ [
|
|
+ 'simdjson/util.cpp',
|
|
+ 'simdjson/csimdjson.pyx'
|
|
+ ],
|
|
+ extra_sources
|
|
+ )),
|
|
define_macros=macros,
|
|
+ libraries=libraries,
|
|
extra_compile_args=extra_compile_args
|
|
)
|
|
], compiler_directives=compiler_directives, force=force)
|
|
@@ -62,12 +73,15 @@ else:
|
|
extensions = [
|
|
Extension(
|
|
'csimdjson',
|
|
- [
|
|
- 'simdjson/simdjson.cpp',
|
|
- 'simdjson/util.cpp',
|
|
- 'simdjson/csimdjson.cpp'
|
|
- ],
|
|
+ list(itertools.chain(
|
|
+ [
|
|
+ 'simdjson/util.cpp',
|
|
+ 'simdjson/csimdjson.cpp'
|
|
+ ],
|
|
+ extra_sources
|
|
+ )),
|
|
extra_compile_args=extra_compile_args,
|
|
+ libraries=libraries,
|
|
language='c++'
|
|
)
|
|
]
|