[arch-commits] Commit in python-wrapt/repos/staging-x86_64 (4 files)

Evangelos Foutras foutrelis at gemini.archlinux.org
Wed Dec 1 21:37:05 UTC 2021


    Date: Wednesday, December 1, 2021 @ 21:37:05
  Author: foutrelis
Revision: 430181

archrelease: copy trunk to staging-x86_64

Added:
  python-wrapt/repos/staging-x86_64/PKGBUILD
    (from rev 430180, python-wrapt/trunk/PKGBUILD)
  python-wrapt/repos/staging-x86_64/py39.patch
    (from rev 430180, python-wrapt/trunk/py39.patch)
Deleted:
  python-wrapt/repos/staging-x86_64/PKGBUILD
  python-wrapt/repos/staging-x86_64/py39.patch

------------+
 PKGBUILD   |   76 ++++++------
 py39.patch |  358 +++++++++++++++++++++++++++++------------------------------
 2 files changed, 217 insertions(+), 217 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2021-12-01 21:37:00 UTC (rev 430180)
+++ PKGBUILD	2021-12-01 21:37:05 UTC (rev 430181)
@@ -1,38 +0,0 @@
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-# Contributor: Troy C < rstrox -ta yahoo -tod com >
-
-pkgname=python-wrapt
-pkgver=1.12.1
-pkgrel=5
-pkgdesc="A Python module for decorators, wrappers and monkey patching"
-arch=("x86_64")
-url="https://pypi.python.org/pypi/wrapt"
-license=("BSD")
-depends=('python')
-makedepends=('python')
-checkdepends=('python-pytest')
-source=("$pkgname-$pkgver.tar.gz::https://github.com/GrahamDumpleton/wrapt/archive/$pkgver.tar.gz"
-        py39.patch)
-sha512sums=('33e964cb3aa2437bc7d084a98f622f7c5c8c719d97806796ae0317d35130bdb2679a9dd87be7077e2cae1eb32b65d152349fa7cc138cb392d5999cbfdcecc9ac'
-            '372323f80578bc1fe2fdf8d3a5dc67b79956180048f8036be429b3e2fed4c9f3ce3d29a2c9e8b6128a2ab64cf7d21dc1e7026e8df14a062a94bd8518aca5b50a')
-
-prepare() {
-  cd "$srcdir"/wrapt-$pkgver
-  patch -Np1 -i ../py39.patch # https://github.com/GrahamDumpleton/wrapt/issues/160
-}
-
-build() {
-  cd "$srcdir"/wrapt-$pkgver
-  python setup.py build
-}
-
-check() {
-  cd "$srcdir"/wrapt-$pkgver
-  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.10:$PYTHONPATH" py.test
-}
-
-package() {
-  cd wrapt-$pkgver
-  python setup.py install --root="$pkgdir" --optimize=1
-  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-}

Copied: python-wrapt/repos/staging-x86_64/PKGBUILD (from rev 430180, python-wrapt/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2021-12-01 21:37:05 UTC (rev 430181)
@@ -0,0 +1,38 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Troy C < rstrox -ta yahoo -tod com >
+
+pkgname=python-wrapt
+pkgver=1.12.1
+pkgrel=6
+pkgdesc="A Python module for decorators, wrappers and monkey patching"
+arch=("x86_64")
+url="https://pypi.python.org/pypi/wrapt"
+license=("BSD")
+depends=('python')
+makedepends=('python')
+checkdepends=('python-pytest')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/GrahamDumpleton/wrapt/archive/$pkgver.tar.gz"
+        py39.patch)
+sha512sums=('33e964cb3aa2437bc7d084a98f622f7c5c8c719d97806796ae0317d35130bdb2679a9dd87be7077e2cae1eb32b65d152349fa7cc138cb392d5999cbfdcecc9ac'
+            '372323f80578bc1fe2fdf8d3a5dc67b79956180048f8036be429b3e2fed4c9f3ce3d29a2c9e8b6128a2ab64cf7d21dc1e7026e8df14a062a94bd8518aca5b50a')
+
+prepare() {
+  cd "$srcdir"/wrapt-$pkgver
+  patch -Np1 -i ../py39.patch # https://github.com/GrahamDumpleton/wrapt/issues/160
+}
+
+build() {
+  cd "$srcdir"/wrapt-$pkgver
+  python setup.py build
+}
+
+check() {
+  cd "$srcdir"/wrapt-$pkgver
+  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.10:$PYTHONPATH" py.test
+}
+
+package() {
+  cd wrapt-$pkgver
+  python setup.py install --root="$pkgdir" --optimize=1
+  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+}

Deleted: py39.patch
===================================================================
--- py39.patch	2021-12-01 21:37:00 UTC (rev 430180)
+++ py39.patch	2021-12-01 21:37:05 UTC (rev 430181)
@@ -1,179 +0,0 @@
-From 33708e76578c173333d1879a4a21baddf8fcdb6a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at 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 @@
- import unittest
- import inspect
- import imp
-+import sys
- 
- import wrapt
- 
-@@ -121,20 +122,26 @@ def test_instance_isinstance(self):
- 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 @@ def _function(cls, *args, **kwargs):
-         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 @@ def test_synchronized_inner_classmethod(self):
-         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)
- 

Copied: python-wrapt/repos/staging-x86_64/py39.patch (from rev 430180, python-wrapt/trunk/py39.patch)
===================================================================
--- py39.patch	                        (rev 0)
+++ py39.patch	2021-12-01 21:37:05 UTC (rev 430181)
@@ -0,0 +1,179 @@
+From 33708e76578c173333d1879a4a21baddf8fcdb6a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at 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 @@
+ import unittest
+ import inspect
+ import imp
++import sys
+ 
+ import wrapt
+ 
+@@ -121,20 +122,26 @@ def test_instance_isinstance(self):
+ 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 @@ def _function(cls, *args, **kwargs):
+         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 @@ def test_synchronized_inner_classmethod(self):
+         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)
+ 



More information about the arch-commits mailing list