Date: Tuesday, April 18, 2023 @ 19:48:37
  Author: dvzrv
Revision: 474157

upgpkg: python-urllib3 1.26.15-1: Upgrade to 1.26.15 and rebuild against Python 
3.11.

Remove the need for python-mock by using unittest.mock.
Switch to PEP517.
Consolidate dependencies.

Modified:
  python-urllib3/trunk/PKGBUILD

----------+
 PKGBUILD |   84 +++++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 60 insertions(+), 24 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-04-18 17:07:51 UTC (rev 474156)
+++ PKGBUILD    2023-04-18 19:48:37 UTC (rev 474157)
@@ -3,26 +3,50 @@
 # Contributor: Chris Brannon <[email protected]>
 # Contributor: BorgHunter <borghunter at gmail dot com>
 
+_name=urllib3
 pkgbase=python-urllib3
 pkgname=(python-urllib3 python-urllib3-doc)
-pkgver=1.26.13
-pkgrel=2
+pkgver=1.26.15
+pkgrel=1
 pkgdesc="HTTP library with thread-safe connection pooling and file post 
support"
 arch=("any")
 url="https://github.com/urllib3/urllib3";
 license=("MIT")
-makedepends=('python-setuptools' 'python-sphinx' 'python-ndg-httpsclient'
-             'python-pyasn1' 'python-pyopenssl'
-             'python-pysocks' 'python-mock'
-             'python-brotli' 'python-sphinx-furo')
-checkdepends=('python-pytest-runner' 'python-tornado' 'python-nose' 
'python-psutil' 'python-trustme'
-              'python-gcp-devrel-py-tools' 'python-flaky' 'python-dateutil')
+makedepends=(
+  'python-build'
+  'python-installer'
+  'python-setuptools'
+  'python-sphinx'
+  'python-sphinx-furo'
+  'python-wheel'
+)
+checkdepends=(
+  'python-brotli'
+  'python-certifi'
+  'python-cryptography'
+  'python-dateutil'
+  'python-flaky'
+  'python-gcp-devrel-py-tools'
+  'python-idna'
+  'python-pyopenssl'
+  'python-pysocks'
+  'python-pytest'
+  'python-pytest-freezegun'
+  'python-pytest-timeout'
+  'python-tornado'
+  'python-trustme'
+)
 
source=("https://github.com/urllib3/urllib3/archive/$pkgver/$pkgbase-$pkgver.tar.gz";)
-sha512sums=('d8b6b7afa6597e934e1deedf98573226a403d83e306c7471195a079086e048a2e30be5c5a3840e39700b276993e6cf9e3a52328acc7d85e5859618392c30f912')
+sha512sums=('edd52a05049a047b1bb913de1cc211a6f7b70802e9ddcb639a973fb910bf218210577a5375077b6569ef382c07668ad6057adb67a31475125c2e5517c603131d')
 
+prepare() {
+  # remove python-mock requirement
+  find $_name-$pkgver -type f -iname "*.py" -exec sed 's/import mock/from 
unittest import mock/; s/from mock/from unittest.mock/' -i {} +
+}
+
 build() {
-  cd urllib3-$pkgver
-  python setup.py build
+  cd $_name-$pkgver
+  python -m build --wheel --no-isolation
 
   cd docs
   PYTHONPATH="../build/lib" make html
@@ -29,23 +53,35 @@
 }
 
 check() {
-  cd urllib3-$pkgver
-  # TODO
-  python setup.py pytest --addopts "--deselect 
test/test_retry.py::TestRetry::test_respect_retry_after_header_sleep \
-                                    --deselect 
test/test_retry_deprecated.py::TestRetry::test_respect_retry_after_header_sleep 
\
-                                    --deselect 
test/contrib/test_pyopenssl.py::TestSSL::test_ssl_read_timeout \
-                                    --deselect 
test/with_dummyserver/test_socketlevel.py::TestSSL::test_ssl_read_timeout"
+  local pytest_options=(
+    -vv
+    # TODO: report upstream
+    --deselect 
test/test_ssltransport.py::SingleTLSLayerTestCase::test_ssl_object_attributes
+    --deselect test/contrib/test_pyopenssl.py::TestSSL::test_ssl_read_timeout
+    --deselect 
test/with_dummyserver/test_socketlevel.py::TestSSL::test_ssl_read_timeout
+  )
+  local site_packages=$(python -c "import site; 
print(site.getsitepackages()[0])")
+
+  cd $_name-$pkgver
+  # install to temporary location, as importlib is used
+  python -m installer --destdir=test_dir dist/*.whl
+  export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
+  pytest "${pytest_options[@]}"
 }
 
 package_python-urllib3() {
   depends=('python')
-  optdepends=('python-pysocks: SOCKS support'
-              'python-brotli: Brotli support'
-              'python-pyopenssl: security support'
-              'python-idna: security support')
+  optdepends=(
+    'python-brotli: Brotli support'
+    'python-certifi: security support'
+    'python-cryptography: security support'
+    'python-idna: security support'
+    'python-pyopenssl: security support'
+    'python-pysocks: SOCKS support'
+  )
 
-  cd urllib3-$pkgver
-  python setup.py install --root="$pkgdir"
+  cd $_name-$pkgver
+  python -m installer --destdir="$pkgdir" dist/*.whl
   install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
 }
 
@@ -52,7 +88,7 @@
 package_python-urllib3-doc() {
   pkgdesc="urllib3 Documentation"
 
-  cd urllib3-$pkgver/docs
+  cd $_name-$pkgver/docs
   install -d "$pkgdir"/usr/share/doc
   cp -r _build/html "$pkgdir"/usr/share/doc/python-urllib3
   install -Dm644 ../LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/

Reply via email to