diff options
author | Louis Sautier <sbraz@gentoo.org> | 2020-10-16 14:01:08 +0200 |
---|---|---|
committer | Louis Sautier <sbraz@gentoo.org> | 2020-10-16 18:30:13 +0200 |
commit | c2c22b849b4b63544729c075468d9d28be2cd92f (patch) | |
tree | 8400b8c3b9c516b06e37a54197fdbecc58922699 /dev-python/sqlalchemy | |
parent | dev-util/cmake: Bump to version 3.19.0_rc1 (diff) | |
download | gentoo-c2c22b849b4b63544729c075468d9d28be2cd92f.tar.gz gentoo-c2c22b849b4b63544729c075468d9d28be2cd92f.tar.bz2 gentoo-c2c22b849b4b63544729c075468d9d28be2cd92f.zip |
dev-python/sqlalchemy: bump to 1.3.20, various fixes
* Backport some commits to fix PyPy3 support.
* Use pytest-xdist to speed up tests.
* Recommend maintained MySQL packages instead of mysql-python.
* Remove unused mock test dependency.
* Remove Python 2 workaround.
* Stop compressing examples.
* This version supports pytest 6 (#748921).
Closes: https://bugs.gentoo.org/748921
Closes: https://bugs.gentoo.org/710040
Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Louis Sautier <sbraz@gentoo.org>
Diffstat (limited to 'dev-python/sqlalchemy')
-rw-r--r-- | dev-python/sqlalchemy/Manifest | 1 | ||||
-rw-r--r-- | dev-python/sqlalchemy/files/sqlalchemy-1.3.20-pypy3.patch | 188 | ||||
-rw-r--r-- | dev-python/sqlalchemy/sqlalchemy-1.3.20.ebuild | 68 |
3 files changed, 257 insertions, 0 deletions
diff --git a/dev-python/sqlalchemy/Manifest b/dev-python/sqlalchemy/Manifest index 556c40c1eaa2..c5caff9cd008 100644 --- a/dev-python/sqlalchemy/Manifest +++ b/dev-python/sqlalchemy/Manifest @@ -1,2 +1,3 @@ DIST SQLAlchemy-1.3.11.tar.gz 6007784 BLAKE2B c889ea28ae08fcb83d338ab01a64533142428ee91a6c11b9a7f2116f99161c066e66f49d76bdd2c7600f1a7f86a2add217f49dda4cf97566a875f28d3d4b24be SHA512 c691539db4edd62af749087728dfd424010bfb3ca2cc8503a4b96c1625d059d4c2a748b9a35cc870cc99ca9df61966cce406f9b570b25e55c3632a99b8621e74 DIST SQLAlchemy-1.3.17.tar.gz 5979141 BLAKE2B f0fa46493461f532ebca9420fc9f49a2c04af888aa99653946a5bb563d40b8bb714a03301300ebb80cca76a99f8226ddfcde4216e8fc2593d3a161b5072276ab SHA512 6f6d54b9018ece6c289f28a3a41ffb1b2216206edee08c49f387e9f30740969dfe0f8272654ce4efca159a2a6619e76c41b2ad2b10c391cdd64681ac17d0bc79 +DIST SQLAlchemy-1.3.20.tar.gz 6264898 BLAKE2B 4c386eff56c2f9ec7ef467e3bc0032629582a970707dc11e3744fe3903d9cb18457f5e0be4dc9c20727b5733f158e031bf8b40f586dadb8f4ab8d0cae3cf7398 SHA512 29c52ada1a66f906ed2563df2ab093eceb7c09de45749c96031f30a1512d20b1d698e00640c777169ef3db99ab012151770a3daea45a51df934269b554ff4b28 diff --git a/dev-python/sqlalchemy/files/sqlalchemy-1.3.20-pypy3.patch b/dev-python/sqlalchemy/files/sqlalchemy-1.3.20-pypy3.patch new file mode 100644 index 000000000000..3455534eb35d --- /dev/null +++ b/dev-python/sqlalchemy/files/sqlalchemy-1.3.20-pypy3.patch @@ -0,0 +1,188 @@ +commit 1607c5c19f8ef362be7182b0ee0fddc6a3d3140e +Author: Federico Caselli <cfederico87@gmail.com> +Date: Sat Apr 18 18:10:59 2020 +0200 + + Enable pypy tests on github workflow + + Fixes: #5223 + Change-Id: I0952e54ed9af2952ea340be1945311376ffc1ad2 + +diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py +index 6f3170a9e..0427eeac5 100644 +--- a/lib/sqlalchemy/orm/mapper.py ++++ b/lib/sqlalchemy/orm/mapper.py +@@ -1326,7 +1326,7 @@ class Mapper(InspectionAttr): + if key == "__init__" and hasattr(method, "_sa_original_init"): + method = method._sa_original_init + if isinstance(method, types.MethodType): +- method = method.im_func ++ method = method.__func__ + if isinstance(method, types.FunctionType): + if hasattr(method, "__sa_reconstructor__"): + self._reconstructor = method +diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py +index ad4ebb656..dc47f671e 100644 +--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py ++++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py +@@ -340,7 +340,7 @@ def %(name)s(%(args)s): + code, {"target": target, "fn": fn}, fn.__name__ + ) + if not add_positional_parameters: +- decorated.__defaults__ = getattr(fn, "im_func", fn).__defaults__ ++ decorated.__defaults__ = getattr(fn, "__func__", fn).__defaults__ + decorated.__wrapped__ = fn + return update_wrapper(decorated, fn) + else: +diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py +index 7de16bcdf..e256d7764 100644 +--- a/lib/sqlalchemy/util/langhelpers.py ++++ b/lib/sqlalchemy/util/langhelpers.py +@@ -151,7 +151,7 @@ def %(name)s(%(args)s): + decorated = _exec_code_in_env( + code, {targ_name: target, fn_name: fn}, fn.__name__ + ) +- decorated.__defaults__ = getattr(fn, "im_func", fn).__defaults__ ++ decorated.__defaults__ = getattr(fn, "__func__", fn).__defaults__ + decorated.__wrapped__ = fn + return update_wrapper(decorated, fn) + +@@ -751,7 +751,7 @@ def monkeypatch_proxied_specials( + fn = getattr(from_cls, method) + if not hasattr(fn, "__call__"): + continue +- fn = getattr(fn, "im_func", fn) ++ fn = getattr(fn, "__func__", fn) + except AttributeError: + continue + try: +diff --git a/test/base/test_utils.py b/test/base/test_utils.py +index 8356de61b..c04dea7cd 100644 +--- a/test/base/test_utils.py ++++ b/test/base/test_utils.py +@@ -411,7 +411,8 @@ class WrapCallableTest(fixtures.TestBase): + lambda: my_functools_default(), my_functools_default + ) + eq_(c.__name__, "partial") +- eq_(c.__doc__, my_functools_default.__call__.__doc__) ++ if not compat.pypy: # pypy fails this check ++ eq_(c.__doc__, my_functools_default.__call__.__doc__) + eq_(c(), 5) + + +diff --git a/test/engine/test_logging.py b/test/engine/test_logging.py +index fe4ff44a7..e14c3a37d 100644 +--- a/test/engine/test_logging.py ++++ b/test/engine/test_logging.py +@@ -8,6 +8,7 @@ from sqlalchemy import or_ + from sqlalchemy import select + from sqlalchemy import String + from sqlalchemy import Table ++from sqlalchemy import testing + from sqlalchemy import util + from sqlalchemy.sql import util as sql_util + from sqlalchemy.testing import assert_raises_message +@@ -460,10 +461,12 @@ class PoolLoggingTest(fixtures.TestBase): + q = self._stpool_logging_fixture() + self._test_queuepool(q, False) + ++ @testing.requires.predictable_gc + def test_queuepool_echo(self): + q = self._queuepool_echo_fixture() + self._test_queuepool(q) + ++ @testing.requires.predictable_gc + def test_queuepool_logging(self): + q = self._queuepool_logging_fixture() + self._test_queuepool(q) +diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py +index 3b989959e..c8cd89555 100644 +--- a/test/engine/test_pool.py ++++ b/test/engine/test_pool.py +@@ -608,6 +608,7 @@ class PoolEventsTest(PoolTestBase): + assert canary.call_args_list[0][0][0] is dbapi_con + assert canary.call_args_list[0][0][2] is exc + ++ @testing.requires.predictable_gc + def test_checkin_event_gc(self): + p, canary = self._checkin_event_fixture() + +diff --git a/test/orm/test_deferred.py b/test/orm/test_deferred.py +index f8817bbd7..2bf466c15 100644 +--- a/test/orm/test_deferred.py ++++ b/test/orm/test_deferred.py +@@ -1700,6 +1700,8 @@ class WithExpressionTest(fixtures.DeclarativeMappedTest): + c1 = s.query(C).order_by(C.id) + eq_(c1.all(), [C(c_expr=1), C(c_expr=1)]) + ++ s.expunge_all() ++ + c2 = ( + s.query(C) + .options(with_expression(C.c_expr, C.x * 2)) + +commit 8d3ac81a8794bdd3532ad07427edf9f48493919d +Date: Wed Oct 14 18:25:45 2020 +0200 + + Skip a failing test that got removed in master + + https://github.com/sqlalchemy/sqlalchemy/commit/a9b068ae564e5e775e312373088545b75aeaa1b0 + +diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py +index 156898f..0d6dc72 100644 +--- a/test/orm/test_deprecations.py ++++ b/test/orm/test_deprecations.py +@@ -560,7 +560,7 @@ class StrongIdentityMapTest(_fixtures.FixtureTest): + def test_prune_imap(self): + self._test_prune(self._strong_ident_fixture) + +- def test_prune_events(self): ++ def _test_prune_events(self): + self._test_prune(self._event_fixture) + + @testing.fails_if(lambda: pypy, "pypy has a real GC") + +commit 1a1cc0e623698a75274f1525d2d14464ff738b86 +Date: Wed Oct 14 18:28:56 2020 +0200 + + Fix PyPy-related tests + + Partial backport of https://github.com/sqlalchemy/sqlalchemy/commit/9e31fc74089cf565df5f275d22eb8ae5414d6e45 + +diff --git a/test/base/test_utils.py b/test/base/test_utils.py +diff --git a/test/base/test_utils.py b/test/base/test_utils.py +index 8356de61b..c3d25b824 100644 +--- a/test/base/test_utils.py ++++ b/test/base/test_utils.py +@@ -1725,7 +1725,7 @@ class ArgInspectionTest(fixtures.TestBase): + + assert_raises(TypeError, get_callable_argspec, datetime.datetime.now) + +- @fails_if(lambda: util.pypy, "pypy returns plain *arg, **kw") ++ @testing.requires.cpython + def test_callable_argspec_obj_init(self): + assert_raises(TypeError, get_callable_argspec, object) + +@@ -2154,10 +2154,7 @@ class TestFormatArgspec(_Py3KFixtures, fixtures.TestBase): + grouped=False, + ) + +- @testing.fails_if( +- lambda: util.pypy, +- "pypy doesn't report Obj.__init__ as object.__init__", +- ) ++ @testing.requires.cpython + def test_init_grouped(self): + object_spec = { + "args": "(self)", +@@ -2181,10 +2178,7 @@ class TestFormatArgspec(_Py3KFixtures, fixtures.TestBase): + self._test_init(None, object_spec, wrapper_spec, custom_spec) + self._test_init(True, object_spec, wrapper_spec, custom_spec) + +- @testing.fails_if( +- lambda: util.pypy, +- "pypy doesn't report Obj.__init__ as object.__init__", +- ) ++ @testing.requires.cpython + def test_init_bare(self): + object_spec = { + "args": "self", diff --git a/dev-python/sqlalchemy/sqlalchemy-1.3.20.ebuild b/dev-python/sqlalchemy/sqlalchemy-1.3.20.ebuild new file mode 100644 index 000000000000..4a9946d21638 --- /dev/null +++ b/dev-python/sqlalchemy/sqlalchemy-1.3.20.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python3_{6..9} ) +PYTHON_REQ_USE="sqlite?" + +inherit distutils-r1 optfeature + +MY_PN="SQLAlchemy" +MY_P="${MY_PN}-${PV/_beta/b}" + +DESCRIPTION="Python SQL toolkit and Object Relational Mapper" +HOMEPAGE="https://www.sqlalchemy.org/ https://pypi.org/project/SQLAlchemy/" +SRC_URI="mirror://pypi/${MY_P:0:1}/${MY_PN}/${MY_P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris" +IUSE="examples +sqlite test" + +REQUIRED_USE="test? ( sqlite )" + +# Use pytest-xdist to speed up tests +BDEPEND=" + test? ( + dev-python/pytest-xdist[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + # Ported part of those commits to fix failing tests: + # https://github.com/sqlalchemy/sqlalchemy/commit/c68f9fb87868c45fcadcc942ce4a35f10ff2f7ea + # https://github.com/sqlalchemy/sqlalchemy/commit/a9b068ae564e5e775e312373088545b75aeaa1b0 + # https://github.com/sqlalchemy/sqlalchemy/commit/9e31fc74089cf565df5f275d22eb8ae5414d6e45 + "${FILESDIR}/${P}-pypy3.patch" +) + +distutils_enable_tests pytest + +python_test() { + # Use all CPUs with pytest-xdist + pytest -n auto -vv || die "Tests failed with ${EPYTHON}" +} + +python_prepare_all() { + # Disable tests hardcoding function call counts specific to Python versions. + rm -r test/aaa_profiling || die + distutils-r1_python_prepare_all +} + +python_install_all() { + if use examples; then + docompress -x "/usr/share/doc/${PF}/examples" + dodoc -r examples + fi + + distutils-r1_python_install_all +} + +pkg_postinst() { + optfeature "MySQL support" dev-python/mysqlclient dev-python/pymysql \ + dev-python/mysql-connector-python + optfeature "mssql support" dev-python/pymssql + optfeature "postgresql support" dev-python/psycopg:2 +} |