1 # Maintainer: Felix Yan <felixonmars@archlinux.org>
2 # Contributor: Patrice Peterson <runiq at archlinux dot us>
3 # Contributor: Chris Brannon <cmbrannon79@gmail.com>
4 # Contributor: BorgHunter <borghunter at gmail dot com>
8 pkgname=(python-urllib3 python-urllib3-doc)
11 pkgdesc="HTTP library with thread-safe connection pooling and file post support"
13 url="https://github.com/urllib3/urllib3"
29 'python-gcp-devrel-py-tools'
34 'python-pytest-freezegun'
35 'python-pytest-timeout'
39 source=("https://github.com/urllib3/urllib3/archive/$pkgver/$pkgbase-$pkgver.tar.gz")
40 sha512sums=('edd52a05049a047b1bb913de1cc211a6f7b70802e9ddcb639a973fb910bf218210577a5375077b6569ef382c07668ad6057adb67a31475125c2e5517c603131d')
43 # remove python-mock requirement
44 find $_name-$pkgver -type f -iname "*.py" -exec sed 's/import mock/from unittest import mock/; s/from mock/from unittest.mock/' -i {} +
49 python -m build --wheel --no-isolation
52 PYTHONPATH="../build/lib" make html
56 local pytest_options=(
58 # TODO: report upstream
59 --deselect test/test_ssltransport.py::SingleTLSLayerTestCase::test_ssl_object_attributes
60 --deselect test/contrib/test_pyopenssl.py::TestSSL::test_ssl_read_timeout
61 --deselect test/with_dummyserver/test_socketlevel.py::TestSSL::test_ssl_read_timeout
63 local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
66 # install to temporary location, as importlib is used
67 python -m installer --destdir=test_dir dist/*.whl
68 export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
69 pytest "${pytest_options[@]}"
72 package_python-urllib3() {
75 'python-brotli: Brotli support'
76 'python-certifi: security support'
77 'python-cryptography: security support'
78 'python-idna: security support'
79 'python-pyopenssl: security support'
80 'python-pysocks: SOCKS support'
84 python -m installer --destdir="$pkgdir" dist/*.whl
85 install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
88 package_python-urllib3-doc() {
89 pkgdesc="urllib3 Documentation"
91 cd $_name-$pkgver/docs
92 install -d "$pkgdir"/usr/share/doc
93 cp -r _build/html "$pkgdir"/usr/share/doc/python-urllib3
94 install -Dm644 ../LICENSE.txt -t "$pkgdir"/usr/share/licenses/$pkgname/