diff options
Diffstat (limited to 'dev-python/semver')
-rw-r--r-- | dev-python/semver/Manifest | 5 | ||||
-rw-r--r-- | dev-python/semver/files/2.10.1-getitem.patch | 147 | ||||
-rw-r--r-- | dev-python/semver/semver-2.10.1.ebuild | 30 | ||||
-rw-r--r-- | dev-python/semver/semver-2.9.0.ebuild | 35 |
4 files changed, 180 insertions, 37 deletions
diff --git a/dev-python/semver/Manifest b/dev-python/semver/Manifest index 299da0b7ece8..3ffe49c7844e 100644 --- a/dev-python/semver/Manifest +++ b/dev-python/semver/Manifest @@ -1,5 +1,6 @@ -DIST semver-2.9.0.tar.gz 24767 BLAKE2B 5fb9eda8c5ccc6b02997292eb6f7be0080480b21bc38bb629fa48af674ec7a356f2b9952459680281a187243acbde17968060c48e4c1af70d10f3bbdf984fbe2 SHA512 5ae9a4a66474fc82cf7e4612796a6c0e0280ad9969ff8c509e99cb266154f39a2c03c68f6167f8e17fda1ac16ce17a838e63d81bc2e78debfd07adbb7cbc098d +AUX 2.10.1-getitem.patch 4231 BLAKE2B 1397f891e02fd92584d3448548c030e8abe1ae01842b826a1868ab00ff332aa6176979a1ffb01cca30a5d82501c884494828b20ca5f810f0780ebfb4ccbe03e7 SHA512 d3bf0e4404581c225c1ed26485f02cd005ec65f03dbcf3f5edc8cafc84f332a8c48f82e6d6375292f866d1d43420051eebcf949e08b40ab1a1ca04ed52550000 +DIST semver-2.10.1.tar.gz 39327 BLAKE2B 867edb0690b07ac460a3c43465047479a4dd84ceadf0eaebaad3c9975994efbf97d51d94c5de2ba6b758b5785649a20acbc2b24a31ab8114b611ac9a24f915c2 SHA512 6abd02f109836c956967ef60c882269818402b771d25a5f243628b6b651bcf9246bbf5b09fac746e65d8c54ffc7b42f21be6cb6dd20487b987a5976995bae51c DIST semver-2.9.1.tar.gz 32437 BLAKE2B f87f6ad001b2e3752c59282714d0dfc258aa8a727517b5b7caeeb9ff2ebc2fb5fce308a96e7728e2f79cbd502bcde5cddc3422563b1c0eb588e41acaba1178c6 SHA512 3de661921d51b19fd4922605677790b7e83ab1e34ef76cd9d6d2147753c122686a801b4ddb0fec1b85018e7c60859885cc27f43bc5e337de1b69b9304b398175 -EBUILD semver-2.9.0.ebuild 728 BLAKE2B 279d3a6383dbac3100c5497ef3eadfda49909841d06c567b21a5e537f55e493003e8e339232f6d0d8c26044717769d6fd12c8ef67d52029da7d9c94c8b6a1ce3 SHA512 7fb89a6223eef6be3b5c5217537b7117cb68d6d0bd35c58dae54e68599775a535a292a19f05ca527b39f7f43a5e5d3d97a4330deee12a38cd8437f2db74748c4 +EBUILD semver-2.10.1.ebuild 700 BLAKE2B 3f7a78674c297932f98a41e3e321f5674e2d08d786880d2b27a3332ff804a4035b38d475a90a2af50baf7f7e8200ff1199839c3aa488b0a1d287097adee88199 SHA512 ec89b7d7dce97e75c467c83b83c9bc00d8b205e08934bebbd7a12f37373bf42bbcd61dc92c11de36b4f3e7701b16b70dda9416c885d899e5299ba044a28d19d3 EBUILD semver-2.9.1.ebuild 634 BLAKE2B df3071945288e833b5e0ca14226e7aa4cbe580673bb55ca2079387908345eb5304619dcc764ff8c34224fc5bef841029d660ab8b79a2cea31ce1867005f77bdf SHA512 c6cd63f6db0b23006379af516b2de00edb440edd13d6b5b90024f7bee2386e1ccd3d720d0be03ab6f90c6cf97eecdccb70de4ab71c74969d399aad994ca1eab4 MISC metadata.xml 378 BLAKE2B c5a9b5c47963a1816ac261fb13f94438d4c3e55a7c7d1ef69ffac63ecd141e63b7b87d90dde26550d521615ea81f40e045ae0e61c9af111d10fbf89abb93284d SHA512 7622874a382b49f80d9565b77ea4c279e560e207c8b149b4b5f386f969c74e92f68b1687de306dc453231c36be3f6a1b9d526d175b555e17d00f467d86dbe41d diff --git a/dev-python/semver/files/2.10.1-getitem.patch b/dev-python/semver/files/2.10.1-getitem.patch new file mode 100644 index 000000000000..1a86ad0449d1 --- /dev/null +++ b/dev-python/semver/files/2.10.1-getitem.patch @@ -0,0 +1,147 @@ +From f332326e54a5582092b50c8fa113d11bbdf1a9e6 Mon Sep 17 00:00:00 2001 +From: Thomas Laferriere <t.laferriere@hotmail.ca> +Date: Wed, 10 Jun 2020 01:44:11 -0400 +Subject: [PATCH] Fix #260 __getitem__ returning `None` on falsy parts + +* Fix #260 and add tests for these special cases +* Fix IndexError not being thrown every time it should +* Update CHANGELOG.rst + +Co-authored-by: Tom Schraitle <tomschr@users.noreply.github.com> +--- + CHANGELOG.rst | 28 ++++++++++++++++++++++++++++ + semver.py | 9 ++++----- + test_semver.py | 35 ++++++++++++++++++++++++++++------- + 3 files changed, 60 insertions(+), 12 deletions(-) + +diff --git a/CHANGELOG.rst b/CHANGELOG.rst +index c28880e..2671ef2 100644 +--- a/CHANGELOG.rst ++++ b/CHANGELOG.rst +@@ -7,6 +7,34 @@ All notable changes to this code base will be documented in this file, + in every released version. + + ++Version 2.10.2 (WIP) ++==================== ++ ++:Released: 2020-xx-yy ++:Maintainer: ++ ++Features ++-------- ++ ++n/a ++ ++Bug Fixes ++--------- ++ ++:gh:`260` (:pr:`261`): Fixed ``__getitem__`` returning None on wrong parts ++ ++ ++Additions ++--------- ++ ++n/a ++ ++Removals ++-------- ++ ++n/a ++ ++ + Version 2.10.1 + ============== + +diff --git a/semver.py b/semver.py +index 00338e8..0c98af9 100644 +--- a/semver.py ++++ b/semver.py +@@ -548,17 +548,16 @@ def __getitem__(self, index): + + if ( + isinstance(index, slice) +- and (index.start is None or index.start < 0) +- and (index.stop is None or index.stop < 0) ++ and (index.start is not None and index.start < 0) ++ or (index.stop is not None and index.stop < 0) + ): + raise IndexError("Version index cannot be negative") + +- # Could raise IndexError: +- part = tuple(filter(None, self.to_tuple()[index])) ++ part = tuple(filter(lambda p: p is not None, self.to_tuple()[index])) + + if len(part) == 1: + part = part[0] +- if not part: ++ elif not part: + raise IndexError("Version part undefined") + return part + +diff --git a/test_semver.py b/test_semver.py +index 8ecc81f..1fd87ee 100644 +--- a/test_semver.py ++++ b/test_semver.py +@@ -774,6 +774,8 @@ def test_should_be_able_to_use_integers_as_prerelease_build(): + ("1.2.3", 0, 1), + ("1.2.3", 1, 2), + ("1.2.3", 2, 3), ++ # Special cases ++ ("1.0.2", 1, 0), + ], + ) + def test_version_info_should_be_accessed_with_index(version, index, expected): +@@ -801,6 +803,7 @@ def test_version_info_should_be_accessed_with_index(version, index, expected): + ("1.2.3-rc.0+build.0", slice(0, 5, 2), (1, 3, "build.0")), + ("1.2.3-rc.0+build.0", slice(None, 5, 2), (1, 3, "build.0")), + ("1.2.3-rc.0+build.0", slice(5, 0, -2), ("build.0", 3)), ++ ("1.2.0-rc.0+build.0", slice(3), (1, 2, 0)), + ], + ) + def test_version_info_should_be_accessed_with_slice_object( +@@ -813,19 +816,37 @@ def test_version_info_should_be_accessed_with_slice_object( + @pytest.mark.parametrize( + "version, index", + [ +- ("1.2.3-rc.0+build.0", -1), +- ("1.2.3-rc.0", -1), +- ("1.2.3-rc.0", 4), +- ("1.2.3", -1), + ("1.2.3", 3), ++ ("1.2.3", slice(3, 4)), + ("1.2.3", 4), +- ("1.2.3", 10), +- ("1.2.3", slice(-3)), ++ ("1.2.3", slice(4, 5)), ++ ("1.2.3", 5), ++ ("1.2.3", slice(5, 6)), ++ ("1.2.3-rc.0", 5), ++ ("1.2.3-rc.0", slice(5, 6)), ++ ("1.2.3-rc.0", 6), ++ ("1.2.3-rc.0", slice(6, 7)), + ], + ) + def test_version_info_should_throw_index_error(version, index): + version_info = VersionInfo.parse(version) +- with pytest.raises(IndexError): ++ with pytest.raises(IndexError, match=r"Version part undefined"): ++ version_info[index] ++ ++ ++@pytest.mark.parametrize( ++ "version, index", ++ [ ++ ("1.2.3", -1), ++ ("1.2.3", -2), ++ ("1.2.3", slice(-2, 2)), ++ ("1.2.3", slice(2, -2)), ++ ("1.2.3", slice(-2, -2)), ++ ], ++) ++def test_version_info_should_throw_index_error_when_negative_index(version, index): ++ version_info = VersionInfo.parse(version) ++ with pytest.raises(IndexError, match=r"Version index cannot be negative"): + version_info[index] + + diff --git a/dev-python/semver/semver-2.10.1.ebuild b/dev-python/semver/semver-2.10.1.ebuild new file mode 100644 index 000000000000..880b90a3488e --- /dev/null +++ b/dev-python/semver/semver-2.10.1.ebuild @@ -0,0 +1,30 @@ +# Copyright 2019-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7,8} ) +DISTUTILS_USE_SETUPTOOLS=rdepend + +inherit distutils-r1 + +DESCRIPTION="A Python module for semantic versioning" +HOMEPAGE="https://github.com/python-semver/python-semver" +SRC_URI="https://github.com/python-${PN}/python-${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64 ~ppc64 ~x86" +IUSE="test" + +S="${WORKDIR}/python-${P}" + +PATCHES=( "${FILESDIR}/${PV}-getitem.patch" ) + +distutils_enable_tests pytest + +python_prepare_all() { + # contains pytest/cov args we don't want + rm setup.cfg || die + distutils-r1_python_prepare_all +} diff --git a/dev-python/semver/semver-2.9.0.ebuild b/dev-python/semver/semver-2.9.0.ebuild deleted file mode 100644 index 70195029b280..000000000000 --- a/dev-python/semver/semver-2.9.0.ebuild +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2019-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PYTHON_COMPAT=( python3_{6,7} ) - -inherit distutils-r1 - -DESCRIPTION="A Python module for semantic versioning" -HOMEPAGE="https://github.com/k-bx/python-semver" -SRC_URI="https://github.com/k-bx/python-${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="BSD" -SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="test" - -BDEPEND=" - dev-python/setuptools[${PYTHON_USEDEP}] - test? ( dev-python/pytest[${PYTHON_USEDEP}] ) -" - -RDEPEND="" - -DEPEND="${RDEPEND}" - -RESTRICT="!test? ( test )" - -S="${WORKDIR}/python-${P}" - -python_test() { - rm setup.cfg || die # contains incompatible pytest args - pytest -v || die "Tests failed with ${EPYTHON}" -} |