dev-python/aspectlib: bump python_compat and tidy up

Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
Alfred Wingate 2022-10-07 23:08:21 +03:00
parent e6eb7ed501
commit 71f1854c95
No known key found for this signature in database
GPG Key ID: A12750536B5E7010
3 changed files with 44 additions and 57 deletions

View File

@ -0,0 +1,37 @@
# Copyright 2021-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517="setuptools"
PYTHON_COMPAT=( python3_{8..11} )
inherit distutils-r1
DESCRIPTION="An aspect-oriented programming, monkey-patch and decorators library."
HOMEPAGE="https://github.com/ionelmc/python-aspectlib"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"
RESTRICT="!test? ( test )"
RDEPEND="dev-python/fields[${PYTHON_USEDEP}]"
DEPEND="
doc? (
dev-python/sphinx-py3doc-enhanced-theme[${PYTHON_USEDEP}]
)
test? (
${RDEPEND}
dev-python/process-tests[${PYTHON_USEDEP}]
dev-python/tornado[${PYTHON_USEDEP}]
)
"
distutils_enable_tests pytest
distutils_enable_sphinx docs
PATCHES=(
"${FILESDIR}/Fix-tests-for-python3_10-and-above.patch"
"${FILESDIR}/Remove-tornado-6-test-constraint.patch"
)

View File

@ -1,50 +0,0 @@
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1
DESCRIPTION="An aspect-oriented programming, monkey-patch and decorators library."
HOMEPAGE="https://github.com/ionelmc/python-aspectlib"
SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc test"
RESTRICT="!test? ( test )"
RDEPEND="dev-python/fields[${PYTHON_USEDEP}]"
DEPEND="
dev-python/sphinx-py3doc-enhanced-theme[${PYTHON_USEDEP}]
test? (
${RDEPEND}
dev-python/process-tests[${PYTHON_USEDEP}]
www-servers/tornado[${PYTHON_USEDEP}]
)
"
BDEPEND="
dev-python/sphinx
"
distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}/Fix-tests-for-python3_10.patch"
"${FILESDIR}/Remove-tornado-6-test-constraint.patch"
)
python_compile_all() {
if use doc; then
sphinx-build -b html docs docs/_build/html || die
fi
sphinx-build -b man docs docs/_build/man || die
}
python_install_all() {
use doc && HTML_DOCS=( docs/_build/html/. )
doman docs/_build/man/*
distutils-r1_python_install_all
}

View File

@ -6,7 +6,7 @@ index b85f1dd..b7d0f70 100644
from .utils import PY2
from .utils import PY3
from .utils import PY37plus
+from .utils import PY310
+from .utils import PY310plus
from .utils import Sentinel
from .utils import basestring
from .utils import force_bind
@ -18,7 +18,7 @@ index 9e0837e..b08f2d6 100644
PY3 = sys.version_info[0] == 3
PY37plus = PY3 and sys.version_info[1] >= 7
+PY310 = PY3 and sys.version_info[1] == 10
+PY310plus = PY3 and sys.version_info[1] >= 10
PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] == 6
PYPY = platform.python_implementation() == 'PyPy'
@ -30,7 +30,7 @@ index 05e2c25..37fe8e8 100644
from test_pkg1.test_pkg2 import test_mod
from aspectlib import PY2
+from aspectlib import PY310
+from aspectlib import PY310plus
from aspectlib.test import OrderedDict
from aspectlib.test import Story
from aspectlib.test import StoryResultWrapper
@ -38,7 +38,7 @@ index 05e2c25..37fe8e8 100644
(('stuff_1', 'mix', "'a', 'b'", ''), _Returns("(1, 2, 'a', 'b')")),
(('stuff_1', 'meth', "123", ''), _Raises(repr_ex(TypeError(
'meth() takes exactly 1 argument (2 given)' if PY2 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
'meth() takes 1 positional argument but 2 were given'
)))),
((None, 'test_pkg1.test_pkg2.test_mod.Stuff', "0, 1", ''), _Binds('stuff_2')),
@ -46,7 +46,7 @@ index 05e2c25..37fe8e8 100644
(('stuff_2', 'mix', "3, 4", ''), _Returns("(0, 1, 3, 4)")),
(('stuff_2', 'meth', "123", ''), _Raises(repr_ex(TypeError(
'meth() takes exactly 1 argument (2 given)' if PY2 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
'meth() takes 1 positional argument but 2 were given'
))))
]))
@ -54,7 +54,7 @@ index 05e2c25..37fe8e8 100644
(('stuff_1', 'meth', '', ''), _Returns('None')),
(('stuff_1', 'meth', '123', ''), _Raises(repr_ex(TypeError(
'meth() takes exactly 1 argument (2 given)' if PY2 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
'meth() takes 1 positional argument but 2 were given'
)))),
((None, 'test_pkg1.test_pkg2.test_mod.Stuff', '0, 1', ''), _Binds("stuff_2")),
@ -62,7 +62,7 @@ index 05e2c25..37fe8e8 100644
(('stuff_2', 'mix', '3, 4', ''), _Returns('(0, 1, 3, 4)')),
(('stuff_2', 'meth', '123', ''), _Raises(repr_ex(TypeError(
'meth() takes exactly 1 argument (2 given)' if PY2 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310 else
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
'meth() takes 1 positional argument but 2 were given'
))))
]))