From e748ba9741f6540f4675c23e3e37b73e822c13a4 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 31 May 2021 20:59:14 +0100 Subject: gentoo resync : 31.05.2021 --- dev-python/pysimdjson/Manifest | 6 +- .../files/pysimdjson-4.0.0-error-types.patch | 53 ++++++++++++ .../files/pysimdjson-4.0.0-unbundle.patch | 95 ++++++++++++++++++++++ dev-python/pysimdjson/metadata.xml | 4 + dev-python/pysimdjson/pysimdjson-4.0.0-r1.ebuild | 43 ++++++++++ 5 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 dev-python/pysimdjson/files/pysimdjson-4.0.0-error-types.patch create mode 100644 dev-python/pysimdjson/files/pysimdjson-4.0.0-unbundle.patch create mode 100644 dev-python/pysimdjson/pysimdjson-4.0.0-r1.ebuild (limited to 'dev-python/pysimdjson') diff --git a/dev-python/pysimdjson/Manifest b/dev-python/pysimdjson/Manifest index e0d1fabbd6f1..b5e9bcfb3d17 100644 --- a/dev-python/pysimdjson/Manifest +++ b/dev-python/pysimdjson/Manifest @@ -1,5 +1,9 @@ +AUX pysimdjson-4.0.0-error-types.patch 1867 BLAKE2B 3c3383d29890363a3d16547bac57884b12ecae899b587ffaa78599f144a32f2cbc5978ee0b831e64933bca0a4caf2d670c03ca4827212c5ff5eb2d439ced79f6 SHA512 2b92745019144113f85171c8964056c0d56cd59f82da4af962cf3891b6056caa7be9601487414523854f03cc5e60c7b977a99ae23bdc83cd69e5fb1dcb53ee4d +AUX pysimdjson-4.0.0-unbundle.patch 2582 BLAKE2B 2005c989186247775a8929b81fe5cf4ac2d7d7e83b6b4b3116f00456ad03cc2e9d6e554e624a129ef6e62e1e3310cdc57b97dbd5452d984865401ae88b057b07 SHA512 49a47e18b7da306bc347675fa1b1a822e9365ef3a5b9d4f3eccdef5b32d6bab9f5d110b93dd90c65075e6b21027d07e93ac6469388d6609b750ca9d72121de19 DIST pysimdjson-3.1.1.tar.gz 3286141 BLAKE2B f1fc63ffcaf524f23112438a8669caf4b4ffa0190bb20e2b851f61dfae386fe02bff1746dd4e68499bdaff3420d41401424fde1332222fe49211d32e09fdcab8 SHA512 9b1080d70f06e5a6d6467769a8146f642adee2c08391a87dd86eca9b0eb7666d9fed47a83d991843b07c2b96906dbf0ccacf2425bfc3ce4cb22731e03b12122e DIST pysimdjson-3.2.0.tar.gz 3357720 BLAKE2B 596738da76d008563e31c6231d348fefb8f37dd4dee2490339a6233ba0a39ab24dc3facf1d02a4621f1d6e01dfb4af8673651d79095919ee7f4532a25dd1c63f SHA512 4c72d71ead5675c2d9b1551b5dacadee013fbaa74f93b2345920f0bac8eb65d79dd84ee817d07fea0bdf477c1c97ca4746048fbdd06a4bfa516e063d89724226 +DIST pysimdjson-4.0.0.tar.gz 3738787 BLAKE2B 744d6bc53511e03e8e716d6c65771432c7bf8f7876bbf8c78d09459a8b170d3d396f9cc8996894f67110f4b7389526d454dffd687b1fda22df7f76f027af44db SHA512 8b3040ce44bb5042b70a14d9f67c312a375d1a12ba7a66466935a48ad0f8def9c21e200c8c93aa755110a674e95920fa7d0567c4f584be5392b70719994a2213 EBUILD pysimdjson-3.1.1-r1.ebuild 512 BLAKE2B ab3793c04071be9c51237465b83fbabbf1593666f00931d1e80379541aea51da4b39b7f5bba340594ae3326c07fc95ebcdeb5bc62e29edd2995b63436fd7ba1d SHA512 93a8e90cdd78ceb402252604e8191047d653ea8409c90c017d11ce55fb16aab6453bf5a9dbbe17abb69f5a63d54cc78a7c058d710457346131744b7ce0ce0a95 EBUILD pysimdjson-3.2.0.ebuild 516 BLAKE2B 0da10517c85e0eb5ce240c67b34252b84b5cbcf563fa960f2e8ba211218b4caf65412873f6a905284f58a490edf7944a8d8e39d3f8c681f11fb46895b64d9b68 SHA512 5f93df21da251b9eff510c518976e7de6f543b0bb20f481cf51c309e77aad56fe813220dec6f15b6d834b2b096810ece317caee9fe77aabea5d5a714d85778e6 -MISC metadata.xml 322 BLAKE2B 94765d38596d2ebe4a27143373174f461b1af57ab29af679c35dbf69f45be48034ffeb424eef6ebc27e4be9e02090b587e216e7bb7f4eb6404523bd9a500435a SHA512 c88bdc79d128f98678accce553f367a1b83f7888e698a05b537387576808d9c547f52b7f963990311082ad06714e883a3da26e6f5cb93ef2b229c56a859d2fef +EBUILD pysimdjson-4.0.0-r1.ebuild 926 BLAKE2B e5f293ed566d8950148e2875f81de146cf56ca2b541d96071f86b6478398788041ff44358fe6dffc7da751c0bfbf56f9e9a071ba7961b1df3f0eed309c52442e SHA512 3e89557d79dbc476a5e737bbf1f8010b3d2c2a4bfc5a5eb45c27194d20e4db9fd26e2cf4c98a536b6c7d0f808d1f1ced5955811b953ea77565868be83e9fa38a +MISC metadata.xml 423 BLAKE2B 06f368507ce8309c6d7b2e2695fdfea636bb503444683450c76f8bc6f8ad7da8b7a0fdcf8ca478445dba7148bc2faad9a5c9f66026777be2c408c3765bf22267 SHA512 b24e60e618e2b4c74ec4a755e99faa0966156ceb188ae5c97feedbfc1d7c19fda73913632b977fe9a5f2ee4261c55b1c0df3488fe7303fe3b9e581cf57979f2b diff --git a/dev-python/pysimdjson/files/pysimdjson-4.0.0-error-types.patch b/dev-python/pysimdjson/files/pysimdjson-4.0.0-error-types.patch new file mode 100644 index 000000000000..34b8f4aa9e29 --- /dev/null +++ b/dev-python/pysimdjson/files/pysimdjson-4.0.0-error-types.patch @@ -0,0 +1,53 @@ +commit 1145be6cac70ed065f2053977d470f3f771ac6a0 +Author: Tyler Kennedy +Date: Sun May 23 15:55:28 2021 -0400 + + Empty buffers now raise identical error to empty bytes. Closes #81. + +diff --git a/simdjson/csimdjson.pyx b/simdjson/csimdjson.pyx +index 095a183..c278e08 100644 +--- a/simdjson/csimdjson.pyx ++++ b/simdjson/csimdjson.pyx +@@ -478,6 +478,13 @@ cdef class Parser: + # type-specific APIs, but gives much greater compatibility. + data = src + ++ if data.size == 0: ++ # If we were given a completely empty buffer, trying to access ++ # 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') ++ + return element_to_primitive( + self, + dereference(self.c_parser).parse( +diff --git a/tests/test_parser.py b/tests/test_parser.py +index 88e7207..d3a28c7 100644 +--- a/tests/test_parser.py ++++ b/tests/test_parser.py +@@ -1,3 +1,4 @@ ++import io + import pathlib + + import pytest +@@ -32,6 +33,19 @@ def test_parse_str(parser): + assert doc.as_dict() == {'hello': 'world'} + + ++def test_parse_empty_buffer(parser): ++ """Ensure trying to parse an empty buffer returns an error consistent ++ with attempting to parse an empty bytestring.""" ++ # Issue #81 ++ with pytest.raises(ValueError) as bytes_exc: ++ parser.parse(b'') ++ ++ with pytest.raises(ValueError) as buffer_exc: ++ parser.parse(io.BytesIO(b'').getbuffer()) ++ ++ assert str(bytes_exc.value) == str(buffer_exc.value) ++ ++ + def test_unicode_decode_error(parser): + """Ensure the parser raises encoding issues.""" + with pytest.raises(UnicodeDecodeError): diff --git a/dev-python/pysimdjson/files/pysimdjson-4.0.0-unbundle.patch b/dev-python/pysimdjson/files/pysimdjson-4.0.0-unbundle.patch new file mode 100644 index 000000000000..de52bc063a24 --- /dev/null +++ b/dev-python/pysimdjson/files/pysimdjson-4.0.0-unbundle.patch @@ -0,0 +1,95 @@ +diff --git a/setup.py b/setup.py +index f1de675..4c23028 100644 +--- a/setup.py ++++ b/setup.py +@@ -27,53 +27,59 @@ if system == 'Darwin': + os.environ.setdefault('MACOSX_DEPLOYMENT_TARGET', '10.14') + extra_compile_args.append('-std=c++11') + +-if os.getenv('BUILD_WITH_CYTHON') and not CYTHON_AVAILABLE: ++build_with_cython = os.getenv('BUILD_WITH_CYTHON') ++if build_with_cython and not CYTHON_AVAILABLE: + print( + 'BUILD_WITH_CYTHON environment variable is set, but cython' + ' is not available. Falling back to pre-cythonized version if' + ' available.' + ) ++ build_with_cython = False + +-if os.getenv('BUILD_WITH_CYTHON') and CYTHON_AVAILABLE: +- macros = [] +- compiler_directives = { +- 'embedsignature': True +- } ++build_with_system_lib = os.getenv('BUILD_WITH_SYSTEM_LIB') ++ ++macros = [] ++compiler_directives = {} ++libraries = [] ++sources = [ ++ 'simdjson/errors.cpp', ++] ++ ++if build_with_system_lib: ++ libraries.append('simdjson') ++else: ++ sources.append('simdjson/simdjson.cpp') ++ ++if build_with_cython: ++ compiler_directives['embedsignature'] = True + + if os.getenv('BUILD_FOR_DEBUG'): + # Enable line tracing, which also enables support for coverage + # reporting. +- macros = [ ++ macros += [ + ('CYTHON_TRACE', 1), + ('CYTHON_TRACE_NOGIL', 1) + ] + compiler_directives['linetrace'] = True + +- extensions = cythonize([ +- Extension( +- 'csimdjson', +- [ +- 'simdjson/simdjson.cpp', +- 'simdjson/errors.cpp', +- 'simdjson/csimdjson.pyx' +- ], +- define_macros=macros, +- extra_compile_args=extra_compile_args +- ) +- ], compiler_directives=compiler_directives) ++ sources.append('simdjson/csimdjson.pyx') + else: +- extensions = [ +- Extension( +- 'csimdjson', +- [ +- 'simdjson/simdjson.cpp', +- 'simdjson/errors.cpp', +- 'simdjson/csimdjson.cpp' +- ], +- extra_compile_args=extra_compile_args, +- language='c++' +- ) +- ] ++ sources.append('simdjson/csimdjson.cpp') ++ ++ ++extensions = [ ++ Extension( ++ 'csimdjson', ++ sources, ++ define_macros=macros, ++ extra_compile_args=extra_compile_args, ++ libraries=libraries, ++ language='c++', ++ ) ++] ++ ++if build_with_cython: ++ extensions = cythonize(extensions, compiler_directives=compiler_directives) + + setup( + name='pysimdjson', diff --git a/dev-python/pysimdjson/metadata.xml b/dev-python/pysimdjson/metadata.xml index bbbada85c7ef..0fbbf43703c8 100644 --- a/dev-python/pysimdjson/metadata.xml +++ b/dev-python/pysimdjson/metadata.xml @@ -5,6 +5,10 @@ chutzpah@gentoo.org Patrick McLean + + python@gentoo.org + Python + pysimdjson diff --git a/dev-python/pysimdjson/pysimdjson-4.0.0-r1.ebuild b/dev-python/pysimdjson/pysimdjson-4.0.0-r1.ebuild new file mode 100644 index 000000000000..165fcadc2520 --- /dev/null +++ b/dev-python/pysimdjson/pysimdjson-4.0.0-r1.ebuild @@ -0,0 +1,43 @@ +# Copyright 2020-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..10} ) +inherit distutils-r1 + +DESCRIPTION="Python bindings for simdjson" +HOMEPAGE="https://github.com/TkTech/pysimdjson" +SRC_URI="https://github.com/TkTech/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="MIT Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND=" + dev-libs/simdjson:= +" +DEPEND=${RDEPEND} +BDEPEND=" + dev-python/cython[${PYTHON_USEDEP}] +" +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/pysimdjson-4.0.0-unbundle.patch + "${FILESDIR}"/pysimdjson-4.0.0-error-types.patch +) + +src_prepare() { + # benchmarks aren't run + sed -i -e 's:pytest-benchmark::' setup.cfg || die + # force regen + rm simdjson/csimdjson.cpp || die + # bundled lib :-( + rm simdjson/simdjson.{cpp,h} || die + + distutils-r1_src_prepare + + export BUILD_WITH_CYTHON=1 + export BUILD_WITH_SYSTEM_LIB=1 +} -- cgit v1.2.3