summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick McLean <chutzpah@gentoo.org>2023-04-27 14:58:28 -0700
committerPatrick McLean <chutzpah@gentoo.org>2023-04-27 15:01:26 -0700
commit950e8988458ce36893c85f1314faf11b8570f425 (patch)
tree8390d2fcd61404f3afface90b593a5fbb442f7be /dev-python/pysimdjson
parentdev-libs/simdjson: Add all-impls USE flag, and enable by default (diff)
downloadgentoo-950e8988458ce36893c85f1314faf11b8570f425.tar.gz
gentoo-950e8988458ce36893c85f1314faf11b8570f425.tar.bz2
gentoo-950e8988458ce36893c85f1314faf11b8570f425.zip
dev-python/pysimdjson: Revbump, use system simdjson
This fixes a bug where the installed library is not importable on python 3.10 Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
Diffstat (limited to 'dev-python/pysimdjson')
-rw-r--r--dev-python/pysimdjson/files/pysimdjson-5.0.2-system-lib.patch72
-rw-r--r--dev-python/pysimdjson/files/pysimdjson-5.0.2-tests.patch13
-rw-r--r--dev-python/pysimdjson/pysimdjson-5.0.2-r1.ebuild (renamed from dev-python/pysimdjson/pysimdjson-5.0.2.ebuild)10
3 files changed, 93 insertions, 2 deletions
diff --git a/dev-python/pysimdjson/files/pysimdjson-5.0.2-system-lib.patch b/dev-python/pysimdjson/files/pysimdjson-5.0.2-system-lib.patch
new file mode 100644
index 000000000000..0a419e5dbc40
--- /dev/null
+++ b/dev-python/pysimdjson/files/pysimdjson-5.0.2-system-lib.patch
@@ -0,0 +1,72 @@
+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++'
+ )
+ ]
diff --git a/dev-python/pysimdjson/files/pysimdjson-5.0.2-tests.patch b/dev-python/pysimdjson/files/pysimdjson-5.0.2-tests.patch
new file mode 100644
index 000000000000..a70143b134f6
--- /dev/null
+++ b/dev-python/pysimdjson/files/pysimdjson-5.0.2-tests.patch
@@ -0,0 +1,13 @@
+diff --git a/simdjson/csimdjson.pyx b/simdjson/csimdjson.pyx
+index 57c5f35..91182fc 100644
+--- a/simdjson/csimdjson.pyx
++++ b/simdjson/csimdjson.pyx
+@@ -480,7 +480,7 @@ cdef class Parser:
+ # a stride in the next step will cause a (potentially
+ # confusing) IndexError. This isn't a very good error message,
+ # but it's identical to the one simdjson would have raised.
+- raise ValueError('Empty: no JSON found')
++ raise ValueError('EMPTY: no JSON found')
+
+ return element_to_primitive(
+ self,
diff --git a/dev-python/pysimdjson/pysimdjson-5.0.2.ebuild b/dev-python/pysimdjson/pysimdjson-5.0.2-r1.ebuild
index ab087fb2f157..2444355952a1 100644
--- a/dev-python/pysimdjson/pysimdjson-5.0.2.ebuild
+++ b/dev-python/pysimdjson/pysimdjson-5.0.2-r1.ebuild
@@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{9..11} )
-
+DISTUTILS_EXT=1
inherit distutils-r1
DESCRIPTION="Python bindings for simdjson"
@@ -24,6 +24,7 @@ KEYWORDS="~amd64 ~x86"
DEPEND="
>=dev-libs/simdjson-2.0.1:=
+ test? ( dev-libs/simdjson[all-impls(-)] )
"
RDEPEND="
${DEPEND}
@@ -32,6 +33,11 @@ BDEPEND="
dev-python/cython[${PYTHON_USEDEP}]
"
+PATCHES=(
+ "${FILESDIR}/pysimdjson-5.0.2-system-lib.patch"
+ "${FILESDIR}/pysimdjson-5.0.2-tests.patch"
+)
+
distutils_enable_tests pytest
src_prepare() {
@@ -45,7 +51,7 @@ src_prepare() {
distutils-r1_src_prepare
- export BUILD_WITH_CYTHON=1
+ export BUILD_WITH_CYTHON=1 BUILD_WITH_SYSTEM_LIB=1
}
python_compile() {