summaryrefslogtreecommitdiff
path: root/dev-python/wrapt
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-05-30 11:44:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-05-30 11:44:06 +0100
commitf516638b7fe9592837389826a6152a7e1b251c54 (patch)
tree8bfecb640b7b6403d7a3d662d923eed630033da7 /dev-python/wrapt
parent1a61119f9f7b057830e2ce0563f913ec86f282ad (diff)
gentoo resync : 30.05.2020
Diffstat (limited to 'dev-python/wrapt')
-rw-r--r--dev-python/wrapt/Manifest3
-rw-r--r--dev-python/wrapt/files/wrapt-1.12.1-py39.patch182
-rw-r--r--dev-python/wrapt/wrapt-1.12.1.ebuild6
3 files changed, 189 insertions, 2 deletions
diff --git a/dev-python/wrapt/Manifest b/dev-python/wrapt/Manifest
index ea25d38a08b4..96d23bef0c1c 100644
--- a/dev-python/wrapt/Manifest
+++ b/dev-python/wrapt/Manifest
@@ -1,5 +1,6 @@
+AUX wrapt-1.12.1-py39.patch 8250 BLAKE2B d3f40b0ef14dc61a12b4e386d1b14b5f5d7f944ea991c7efb70c535b5f77c489feb31f9b162c9aa6fb68236bd0775ceed6c6582247ca0aacbb79255c90b10d57 SHA512 e157e40e720a173762ca227a1daa0acc7fc437f632943c5b5158cb776b32457d592571ff7dadc4f0069b5ace9cb1fd2ebb51807d78d62ca94d8148a4d5be48aa
DIST wrapt-1.11.2.tar.gz 124874 BLAKE2B 262518e097753830d80d834e1dcd5afe9c743e7cad8fad992146829255b99ef0c1a6d0344674935bb6beae9a8e5f42a1a4ade760f7300d104b1a17bc6f94f91f SHA512 2551247c46fbc34068e0f2d6efa91d8c87669c8bf1e16c3b5e2e5e0d84402301c38a78485b7e9a13120c99c9c942db680a84d87a52a072d530aba6444d86297d
DIST wrapt-1.12.1.tar.gz 126750 BLAKE2B 92aba2d400aa626445be68fdda2831132e1c341a2f20065b3d7071a2ebc174cb9de7e6a20a8375360cf7df181881fd20b7b2f70dbfdf533e8823982eeaa722f5 SHA512 33e964cb3aa2437bc7d084a98f622f7c5c8c719d97806796ae0317d35130bdb2679a9dd87be7077e2cae1eb32b65d152349fa7cc138cb392d5999cbfdcecc9ac
EBUILD wrapt-1.11.2-r1.ebuild 711 BLAKE2B a10d2574450e0b90382a0f5d518785492fe071dd93015ed1b760d6809bf221babee875b73218675be73d4e8bb32ba9513ec8b81a5573cf2760560db61596bed3 SHA512 4cabf49d48a79d852b920bfcd948cf5ad89dfbd1075f0eca224e893459fe28ed736499928b1fef83f3026002d23858c3373495196cb1b106144e2bbfa2ac961a
-EBUILD wrapt-1.12.1.ebuild 721 BLAKE2B 847f9169d294ef3b969fb35c29666563a359fabf66bb70ad99f041562eab1fdff96785a4d06f69f6c776e200838586154e723bcb1aa3d8c58a9e6438db88eaa3 SHA512 8081e592d856c5a0f237dc1ef5c71c0ca56afff8ec1fb2d18b5bf83319b5b4517d2aac62f31ec6300b82e70fb03f5edfb9339cf4c66f6b253953978e523b6962
+EBUILD wrapt-1.12.1.ebuild 767 BLAKE2B 499e13e3dd48e2fbc4e98e75552e0d7f74863de4e89999cccbbeaa15247e53a95085827b77590fb1d42ad07d771b1214a7c4664a32a7cdf68bc47014667ab2c1 SHA512 b18e29f05fabb55dbf8f7812d0528af6d37a9f64b7b8970d6e794f07841c06071c31be0f52fca425b2cbacecc9e5981f73f64e68c680904d00f575bec77f25ae
MISC metadata.xml 369 BLAKE2B 6a901e590d47a47fb9fe27cafa1708f61f0a3285b651ddcb138ee1fe1add01a163a031dfb9f37b6706fe1712a9da42903317a7560915be98524168e7dfee438c SHA512 2e999c320cf8b1894ef8efea6262304c7902e37692cefb376c36a16cf457133255a8f7c709e329232614fce918d65a82b61f2f340fdc277ae8d1b37c6d60a3ad
diff --git a/dev-python/wrapt/files/wrapt-1.12.1-py39.patch b/dev-python/wrapt/files/wrapt-1.12.1-py39.patch
new file mode 100644
index 000000000000..c3e85e09b660
--- /dev/null
+++ b/dev-python/wrapt/files/wrapt-1.12.1-py39.patch
@@ -0,0 +1,182 @@
+From 33708e76578c173333d1879a4a21baddf8fcdb6a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 29 May 2020 16:06:07 +0200
+Subject: [PATCH] Update for fixed outer @classmethod behavior in Python 3.9
+
+Fixes #160
+---
+ docs/decorators.rst | 18 ++++++-------
+ tests/test_outer_classmethod.py | 45 +++++++++++++++++++++------------
+ tests/test_synchronized_lock.py | 22 ++++++++--------
+ 3 files changed, 49 insertions(+), 36 deletions(-)
+
+diff --git a/docs/decorators.rst b/docs/decorators.rst
+index b8200d6..94201de 100644
+--- a/docs/decorators.rst
++++ b/docs/decorators.rst
+@@ -641,15 +641,15 @@ When calling the wrapped function in the decorator wrapper function, the
+ instance is already bound to ``wrapped`` and will be passed automatically
+ as the first argument to the original wrapped function.
+
+-Note that due to a bug in Python ``classmethod.__get__()``, whereby it does
+-not apply the descriptor protocol to the function wrapped by ``@classmethod``,
+-the above only applies where the decorator wraps the ``@classmethod``
+-decorator. If the decorator is placed inside of the ``@classmethod``
+-decorator, then ``instance`` will be ``None`` and the decorator wrapper
+-function will see the call as being the same as a normal function. As a
+-result, always place any decorator outside of the ``@classmethod``
+-decorator. Hopefully this issue in Python can be addressed in a future
+-Python version.
++Note that due to a bug in Python prior to 3.9 ``classmethod.__get__()``,
++whereby it does not apply the descriptor protocol to the function
++wrapped by ``@classmethod``, the above only applies where the decorator
++wraps the ``@classmethod`` decorator. If the decorator is placed inside
++of the ``@classmethod`` decorator, then ``instance`` will be ``None``
++and the decorator wrapper function will see the call as being the same
++as a normal function. As a result, always place any decorator outside of
++the ``@classmethod`` decorator if you need to support earlier Python
++versions.
+
+ Decorating Static Methods
+ -------------------------
+diff --git a/tests/test_outer_classmethod.py b/tests/test_outer_classmethod.py
+index 6b4af4f..9c2fcb8 100644
+--- a/tests/test_outer_classmethod.py
++++ b/tests/test_outer_classmethod.py
+@@ -3,6 +3,7 @@ from __future__ import print_function
+ import unittest
+ import inspect
+ import imp
++import sys
+
+ import wrapt
+
+@@ -121,20 +122,26 @@ class TestNamingOuterClassMethod(unittest.TestCase):
+ class TestCallingOuterClassMethod(unittest.TestCase):
+
+ def test_class_call_function(self):
+- # Test calling classmethod. The instance and class passed to the
+- # wrapper will both be None because our decorator is surrounded
+- # by the classmethod decorator. The classmethod decorator
+- # doesn't bind the method and treats it like a normal function,
+- # explicitly passing the class as the first argument with the
+- # actual arguments following that.
++ # Test calling classmethod. In Python 3.9, the class will be
++ # passed as instance. In older versions of Python, the instance
++ # and class passed to the wrapper will both be None because our
++ # decorator is surrounded by the classmethod decorator.
++ # The classmethod decorator doesn't bind the method and treats
++ # it like a normal function, explicitly passing the class
++ # as the first argument with the actual arguments following
++ # that.
+
+ _args = (1, 2)
+ _kwargs = {'one': 1, 'two': 2}
+
+ @wrapt.decorator
+ def _decorator(wrapped, instance, args, kwargs):
+- self.assertEqual(instance, None)
+- self.assertEqual(args, (Class,)+_args)
++ if sys.hexversion >= 0x03090000:
++ self.assertEqual(instance, Class)
++ self.assertEqual(args, _args)
++ else:
++ self.assertEqual(instance, None)
++ self.assertEqual(args, (Class,)+_args)
+ self.assertEqual(kwargs, _kwargs)
+ self.assertEqual(wrapped.__module__, _function.__module__)
+ self.assertEqual(wrapped.__name__, _function.__name__)
+@@ -155,20 +162,26 @@ class TestCallingOuterClassMethod(unittest.TestCase):
+ self.assertEqual(result, (_args, _kwargs))
+
+ def test_instance_call_function(self):
+- # Test calling classmethod via class instance. The instance
+- # and class passed to the wrapper will both be None because our
+- # decorator is surrounded by the classmethod decorator. The
+- # classmethod decorator doesn't bind the method and treats it
+- # like a normal function, explicitly passing the class as the
+- # first argument with the actual arguments following that.
++ # Test calling classmethod via class instance. In Python 3.9,
++ # the class will be passed as instance. In older versions
++ # of Python, the instance and class passed to the wrapper will
++ # both be None because our decorator is surrounded
++ # by the classmethod decorator. The classmethod decorator
++ # doesn't bind the method and treats it like a normal function,
++ # explicitly passing the class as the first argument with
++ # the actual arguments following that.
+
+ _args = (1, 2)
+ _kwargs = {'one': 1, 'two': 2}
+
+ @wrapt.decorator
+ def _decorator(wrapped, instance, args, kwargs):
+- self.assertEqual(instance, None)
+- self.assertEqual(args, (Class,)+_args)
++ if sys.hexversion >= 0x03090000:
++ self.assertEqual(instance, Class)
++ self.assertEqual(args, _args)
++ else:
++ self.assertEqual(instance, None)
++ self.assertEqual(args, (Class,)+_args)
+ self.assertEqual(kwargs, _kwargs)
+ self.assertEqual(wrapped.__module__, _function.__module__)
+ self.assertEqual(wrapped.__name__, _function.__name__)
+diff --git a/tests/test_synchronized_lock.py b/tests/test_synchronized_lock.py
+index 6e7eb12..b8f60f3 100644
+--- a/tests/test_synchronized_lock.py
++++ b/tests/test_synchronized_lock.py
+@@ -1,5 +1,6 @@
+ from __future__ import print_function
+
++import sys
+ import unittest
+
+ import wrapt
+@@ -157,34 +158,33 @@ class TestSynchronized(unittest.TestCase):
+ self.assertEqual(_lock3, _lock2)
+
+ def test_synchronized_outer_classmethod(self):
+- # XXX If all was good, this would be detected as a class
++ # Bug in Python < 3.9:
++ # If all was good, this would be detected as a class
+ # method call, but the classmethod decorator doesn't bind
+ # the wrapped function to the class before calling and
+ # just calls it direct, explicitly passing the class as
+- # first argument. This screws things up. Would be nice if
+- # Python were fixed, but that isn't likely to happen.
++ # first argument. This screws things up.
+
+- #_lock0 = getattr(C4, '_synchronized_lock', None)
+- _lock0 = getattr(C4.function2, '_synchronized_lock', None)
++ lock_target = (C4 if sys.hexversion >= 0x03090000
++ else C4.function2)
++
++ _lock0 = getattr(lock_target, '_synchronized_lock', None)
+ self.assertEqual(_lock0, None)
+
+ c4.function2()
+
+- #_lock1 = getattr(C4, '_synchronized_lock', None)
+- _lock1 = getattr(C4.function2, '_synchronized_lock', None)
++ _lock1 = getattr(lock_target, '_synchronized_lock', None)
+ self.assertNotEqual(_lock1, None)
+
+ C4.function2()
+
+- #_lock2 = getattr(C4, '_synchronized_lock', None)
+- _lock2 = getattr(C4.function2, '_synchronized_lock', None)
++ _lock2 = getattr(lock_target, '_synchronized_lock', None)
+ self.assertNotEqual(_lock2, None)
+ self.assertEqual(_lock2, _lock1)
+
+ C4.function2()
+
+- #_lock3 = getattr(C4, '_synchronized_lock', None)
+- _lock3 = getattr(C4.function2, '_synchronized_lock', None)
++ _lock3 = getattr(lock_target, '_synchronized_lock', None)
+ self.assertNotEqual(_lock3, None)
+ self.assertEqual(_lock3, _lock2)
+
+--
+2.26.2
+
diff --git a/dev-python/wrapt/wrapt-1.12.1.ebuild b/dev-python/wrapt/wrapt-1.12.1.ebuild
index 6634d9007d7c..24fccc88aafa 100644
--- a/dev-python/wrapt/wrapt-1.12.1.ebuild
+++ b/dev-python/wrapt/wrapt-1.12.1.ebuild
@@ -4,7 +4,7 @@
EAPI=7
DISTUTILS_USE_SETUPTOOLS=no
-PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
+PYTHON_COMPAT=( python3_{6,7,8,9} pypy3 )
inherit distutils-r1
@@ -19,6 +19,10 @@ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-l
distutils_enable_tests pytest
distutils_enable_sphinx docs dev-python/sphinx_rtd_theme
+PATCHES=(
+ "${FILESDIR}"/${P}-py39.patch
+)
+
python_compile() {
local WRAPT_EXTENSIONS=true