From 068424b26532f3551a81421a9be67ed206e5c11a Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 11 Aug 2021 07:02:28 +0100 Subject: gentoo resync : 11.08.2021 --- dev-python/python-lzo/Manifest | 2 + .../files/python-lzo-1.12-fix-py3.10.patch | 159 +++++++++++++++++++++ dev-python/python-lzo/python-lzo-1.12-r2.ebuild | 34 +++++ 3 files changed, 195 insertions(+) create mode 100644 dev-python/python-lzo/files/python-lzo-1.12-fix-py3.10.patch create mode 100644 dev-python/python-lzo/python-lzo-1.12-r2.ebuild (limited to 'dev-python/python-lzo') diff --git a/dev-python/python-lzo/Manifest b/dev-python/python-lzo/Manifest index 5a0744e2d429..a52dd99a08b7 100644 --- a/dev-python/python-lzo/Manifest +++ b/dev-python/python-lzo/Manifest @@ -1,3 +1,5 @@ +AUX python-lzo-1.12-fix-py3.10.patch 4320 BLAKE2B 30fc47fbb2d99d1cd86771bd819fe6f549e8429d3d76a23b0051e7fafb3f93f689958400bb41af51cdccedfaba483b2d82fe14454b9bf27652955203e1e89dc5 SHA512 458ff5700ed6d50dcb03321319286e16d852f3158670b625be8dd0cfbb55483a79e2f8f0de9eb33bcb1b5a76fb46b96074bb7711a15535701337d0a68302a3e3 DIST python-lzo-1.12.tar.gz 14042 BLAKE2B 7375e9b200a17cc1ad2c4dfdbe6491082af8d120b2b659b1e9bbff00eaae568e04dc12e5c13de3a028267a1e8e02bd1522a9335db73fa6a5a4ebc7ca4b341fff SHA512 811bdb282cfaf33427ad641d0342900c5af1f17b7033d76593288c3846b0feefe6ef93253152add97b2d6420f937de2745c8e7508dadf33e72b11545cac3be4d EBUILD python-lzo-1.12-r1.ebuild 693 BLAKE2B 2afcdc478edcfc06c5570dc7ceb247086e37c180efc1ee5351995024a95e454fae649743e3aed49e9997fa83249f52b9e51d6766bcb90f4ccb133cfebec9b332 SHA512 7c45ad70fcd08276aaf471ad53ef92a9e6cbe151982eac5787a14ae21403a6ab9d8d44bccdaf963c88f8a4028eb5ae2b5dc556fc2fc729fb2690c7d5a0ea94a0 +EBUILD python-lzo-1.12-r2.ebuild 835 BLAKE2B 46f3062e386baebfd30f6f728dd2fb9dde387b9ef3c9cdfb74a76a5f83cfedcd807448fc220b41e4884bb963e52cb50732b180ed6dd5a5d6f2728adb6e1118fd SHA512 13bbd4f3c2de2df92a6d058e426bf100171a99c7400a5b6d77743234bb6be946678c16144328986a1110ff087fca33f2baf29b191d8d888c3cdb942fd2c4e434 MISC metadata.xml 385 BLAKE2B 4a726b1896f55aa03b8b9a1a1f39107751f372b7bb7b0b9759447a7d42fcc97c142ea6ea3a2de8358d0bc00cb0e73b12c78c0b03e8c52c93092220761b6eecef SHA512 634d30e62ce3a8c09b3de241642e9ce8b059d9d3ff02e6530642dea4b0b4bcc8f108566bdc5ba52f6e63214546e11f734bdc094ef60ad13197b9f74cab71d03c diff --git a/dev-python/python-lzo/files/python-lzo-1.12-fix-py3.10.patch b/dev-python/python-lzo/files/python-lzo-1.12-fix-py3.10.patch new file mode 100644 index 000000000000..17bad96d6278 --- /dev/null +++ b/dev-python/python-lzo/files/python-lzo-1.12-fix-py3.10.patch @@ -0,0 +1,159 @@ +diff --git a/lzomodule.c b/lzomodule.c +index b5fa542..e9ca432 100644 +--- a/lzomodule.c ++++ b/lzomodule.c +@@ -31,6 +31,8 @@ + + #define MODULE_VERSION "1.12" + ++#define PY_SSIZE_T_CLEAN ++ + #include + #include + +@@ -83,7 +85,7 @@ compress(PyObject *dummy, PyObject *args) + lzo_uint in_len; + lzo_uint out_len; + lzo_uint new_len; +- int len; ++ Py_ssize_t len; + int level = 1; + int header = 1; + int err; +@@ -95,6 +97,16 @@ compress(PyObject *dummy, PyObject *args) + if (len < 0) + return NULL; + ++ if (len > LZO_UINT_MAX) { ++ PyErr_SetString(LzoError, "Input size is larger than LZO_UINT_MAX"); ++ return NULL; ++ } ++ ++ if ((len + len / 16 + 64 + 3) > LZO_UINT_MAX) { ++ PyErr_SetString(LzoError, "Output size is larger than LZO_UINT_MAX"); ++ return NULL; ++ } ++ + in_len = len; + out_len = in_len + in_len / 16 + 64 + 3; + +@@ -189,7 +201,7 @@ decompress(PyObject *dummy, PyObject *args) + lzo_uint in_len; + lzo_uint out_len; + lzo_uint new_len; +- int len; ++ Py_ssize_t len; + int buflen = -1; + int header = 1; + int err; +@@ -274,7 +286,7 @@ optimize(PyObject *dummy, PyObject *args) + lzo_uint in_len; + lzo_uint out_len; + lzo_uint new_len; +- int len; ++ Py_ssize_t len; + int err; + int header = 1; + int buflen = -1; +@@ -356,7 +368,7 @@ static PyObject * + adler32(PyObject *dummy, PyObject *args) + { + char *buf; +- int len; ++ Py_ssize_t len; + unsigned long val = 1; /* == lzo_adler32(0, NULL, 0); */ + + UNUSED(dummy); +@@ -392,7 +404,7 @@ static PyObject * + crc32(PyObject *dummy, PyObject *args) + { + char *buf; +- int len; ++ Py_ssize_t len; + unsigned long val = 0; /* == lzo_crc32(0, NULL, 0); */ + + UNUSED(dummy); +diff --git a/tests/test.py b/tests/test.py +index 9a96ce7..af761d9 100644 +--- a/tests/test.py ++++ b/tests/test.py +@@ -96,11 +96,17 @@ def test_version(): + + def test_lzo(): + yield gen, b"aaaaaaaaaaaaaaaaaaaaaaaa" +- yield gen_raw, b"aaaaaaaaaaaaaaaaaaaaaaaa" + yield gen, b"abcabcabcabcabcabcabcabc" +- yield gen_raw, b"abcabcabcabcabcabcabcabc" + yield gen, b"abcabcabcabcabcabcabcabc", 9 ++ ++ ++def test_lzo_raw(): ++ yield gen_raw, b"aaaaaaaaaaaaaaaaaaaaaaaa" ++ yield gen_raw, b"abcabcabcabcabcabcabcabc" + yield gen_raw, b"abcabcabcabcabcabcabcabc", 9 ++ ++ ++def test_lzo_empty(): + yield gen, b"" + yield gen_raw, b"" + +@@ -113,41 +119,8 @@ def test_lzo_raw_big(): + gen_raw(b" " * 131072) + + +-def main(args): +- # display version information and module documentation +- print("LZO version %s (0x%x), %s" % (lzo.LZO_VERSION_STRING, lzo.LZO_VERSION, lzo.LZO_VERSION_DATE)) +- print(lzo.__file__) +- print() +- print(lzo.__doc__) +- +- # display additional module information +- ## print dir(lzo) +- ## print_modinfo() +- +- # compress some simple strings +- gen(b"aaaaaaaaaaaaaaaaaaaaaaaa") +- gen_raw(b"aaaaaaaaaaaaaaaaaaaaaaaa") +- gen(b"abcabcabcabcabcabcabcabc") +- gen_raw(b"abcabcabcabcabcabcabcabc") +- gen(b"abcabcabcabcabcabcabcabc", level=9) +- gen_raw(b"abcabcabcabcabcabcabcabc", level=9) +- gen(b" " * 131072) +- gen_raw(b" " * 131072) +- gen(b"") +- gen_raw(b"") +- print("Simple compression test passed.") +- +- test_version() +- +- # force an exception (because of invalid compressed data) +- assert issubclass(lzo.error, Exception) +- try: +- x = lzo.decompress("xx") +- except lzo.error: +- pass +- else: +- print("Exception handling does NOT work !") +- return 0 +- +-if __name__ == '__main__': +- sys.exit(main(sys.argv)) ++if sys.maxsize > 1<<32: ++ # This test raises OverflowError on 32-bit Pythons. Compressing ++ # this much data requires a 64-bit system. ++ def test_lzo_compress_extremely_big(): ++ b = lzo.compress(bytes(bytearray((1024**3)*2))) +diff --git a/tests/util.py b/tests/util.py +index 0a2f4ed..c7bd5f0 100644 +--- a/tests/util.py ++++ b/tests/util.py +@@ -45,7 +45,7 @@ def get_sys_path(p=None): + if p: p0 = p[0] + # + plat = get_platform() +- plat_specifier = "%s-%s" % (plat, sys.version[:3]) ++ plat_specifier = "%s-%d.%d" % (plat, sys.version_info[0], sys.version_info[1]) + ##print plat, plat_specifier + # + for prefix in (p0, os.curdir, os.pardir,): diff --git a/dev-python/python-lzo/python-lzo-1.12-r2.ebuild b/dev-python/python-lzo/python-lzo-1.12-r2.ebuild new file mode 100644 index 000000000000..f3636cc05cb8 --- /dev/null +++ b/dev-python/python-lzo/python-lzo-1.12-r2.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_SETUPTOOLS=no +PYTHON_COMPAT=( python3_{8..10} ) + +inherit distutils-r1 prefix + +DESCRIPTION="Python interface to lzo" +HOMEPAGE="https://github.com/jd-boyd/python-lzo" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" + +RDEPEND="dev-libs/lzo:2" +DEPEND="${RDEPEND}" + +# We can't use pytest at the moment because the package uses "yield tests" +# https://docs.pytest.org/en/6.2.x/deprecations.html#yield-tests +distutils_enable_tests --install nose + +PATCHES=( + # Upstream commits: 52440984, e63333e5, 15c40595 and 0a4272fc + "${FILESDIR}/${P}-fix-py3.10.patch" +) + +python_prepare_all() { + hprefixify setup.py + distutils-r1_python_prepare_all +} -- cgit v1.2.3