From 8ca3b6b71e0fee3c037ee436f541995726ea6bae Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 21 Dec 2020 10:16:09 +0100 Subject: dev-python/backports-zoneinfo: Backport segv fix for py3.8.7rc1+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- .../backports-zoneinfo-0.2.1-r1.ebuild | 66 ++++++++++++++++++++++ .../backports-zoneinfo-0.2.1.ebuild | 60 -------------------- .../files/backports-zoneinfo-0.2.1-py38.patch | 22 ++++++++ 3 files changed, 88 insertions(+), 60 deletions(-) create mode 100644 dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1-r1.ebuild delete mode 100644 dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1.ebuild create mode 100644 dev-python/backports-zoneinfo/files/backports-zoneinfo-0.2.1-py38.patch (limited to 'dev-python/backports-zoneinfo') diff --git a/dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1-r1.ebuild b/dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1-r1.ebuild new file mode 100644 index 000000000000..77b7ae5c51dc --- /dev/null +++ b/dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1-r1.ebuild @@ -0,0 +1,66 @@ +# Copyright 2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6..8} pypy3 ) +inherit distutils-r1 + +MY_P=${P#backports-} +DESCRIPTION="Backport of the standard library zoneinfo module" +HOMEPAGE="https://github.com/pganssle/zoneinfo/" +SRC_URI=" + https://github.com/pganssle/zoneinfo/archive/${PV}.tar.gz + -> ${MY_P}.tar.gz" +S=${WORKDIR}/${MY_P} + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos" + +RDEPEND=" + $(python_gen_cond_dep ' + dev-python/importlib_resources[${PYTHON_USEDEP}] + ' python3_6 pypy3)" +BDEPEND=" + test? ( + $(python_gen_cond_dep ' + dev-python/dataclasses[${PYTHON_USEDEP}] + ' python3_6) + $(python_gen_cond_dep ' + dev-python/importlib_metadata[${PYTHON_USEDEP}] + ' python3_{6,7}) + >=dev-python/hypothesis-5.7.0[${PYTHON_USEDEP}] + dev-python/pytest[${PYTHON_USEDEP}] + )" + +# pytest is used only for one skip, and requires unpackaged +# pytest-subtests +distutils_enable_tests unittest + +PATCHES=( + # fix segv in py3.8.7rc1+ + # https://github.com/pganssle/zoneinfo/pull/97 + "${FILESDIR}"/${P}-py38.patch +) + +python_test() { + if [[ ${EPYTHON} == pypy3 ]]; then + # pypy3.6 does not support dataclasses, and the backport + # does not work with pypy + local pypy3_version=$(best_version -b 'dev-python/pypy3') + if [[ ${pypy3_version} != *_p37* ]]; then + einfo "Skipping tests on pypy3.6 due to missing deps" + return + fi + fi + + "${EPYTHON}" -m unittest discover -v || + die "Tests failed with ${EPYTHON}" +} + +python_install() { + # avoid file collisions + rm "${BUILD_DIR}"/lib/backports/__init__.py || die + distutils-r1_python_install +} diff --git a/dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1.ebuild b/dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1.ebuild deleted file mode 100644 index 29e10ab9d793..000000000000 --- a/dev-python/backports-zoneinfo/backports-zoneinfo-0.2.1.ebuild +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{6..8} pypy3 ) -inherit distutils-r1 - -MY_P=${P#backports-} -DESCRIPTION="Backport of the standard library zoneinfo module" -HOMEPAGE="https://github.com/pganssle/zoneinfo/" -SRC_URI=" - https://github.com/pganssle/zoneinfo/archive/${PV}.tar.gz - -> ${MY_P}.tar.gz" -S=${WORKDIR}/${MY_P} - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos" - -RDEPEND=" - $(python_gen_cond_dep ' - dev-python/importlib_resources[${PYTHON_USEDEP}] - ' python3_6 pypy3)" -BDEPEND=" - test? ( - $(python_gen_cond_dep ' - dev-python/dataclasses[${PYTHON_USEDEP}] - ' python3_6) - $(python_gen_cond_dep ' - dev-python/importlib_metadata[${PYTHON_USEDEP}] - ' python3_{6,7}) - >=dev-python/hypothesis-5.7.0[${PYTHON_USEDEP}] - dev-python/pytest[${PYTHON_USEDEP}] - )" - -# pytest is used only for one skip, and requires unpackaged -# pytest-subtests -distutils_enable_tests unittest - -python_test() { - if [[ ${EPYTHON} == pypy3 ]]; then - # pypy3.6 does not support dataclasses, and the backport - # does not work with pypy - local pypy3_version=$(best_version -b 'dev-python/pypy3') - if [[ ${pypy3_version} != *_p37* ]]; then - einfo "Skipping tests on pypy3.6 due to missing deps" - return - fi - fi - - "${EPYTHON}" -m unittest discover -v || - die "Tests failed with ${EPYTHON}" -} - -python_install() { - # avoid file collisions - rm "${BUILD_DIR}"/lib/backports/__init__.py || die - distutils-r1_python_install -} diff --git a/dev-python/backports-zoneinfo/files/backports-zoneinfo-0.2.1-py38.patch b/dev-python/backports-zoneinfo/files/backports-zoneinfo-0.2.1-py38.patch new file mode 100644 index 000000000000..dbe9695a9a53 --- /dev/null +++ b/dev-python/backports-zoneinfo/files/backports-zoneinfo-0.2.1-py38.patch @@ -0,0 +1,22 @@ +From 0e42cc3999b4e3833b5f3f41857b8c1e3c9143f3 Mon Sep 17 00:00:00 2001 +From: Pablo Galindo +Date: Mon, 21 Dec 2020 02:02:34 +0000 +Subject: [PATCH] Decrement the refcount of _PyLong_One in the correct branch + +--- + lib/zoneinfo_module.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/zoneinfo_module.c b/lib/zoneinfo_module.c +index e0c72d3..07ef603 100644 +--- a/lib/zoneinfo_module.c ++++ b/lib/zoneinfo_module.c +@@ -616,7 +616,7 @@ zoneinfo_fromutc(PyObject *obj_self, PyObject *dt) + Py_DECREF(args); + Py_DECREF(kwargs); + Py_DECREF(replace); +-#ifndef ATLEAST_37 ++#ifdef ATLEAST_37 + Py_DECREF(one); + #endif + -- cgit v1.2.3-65-gdbad