archrelease: copy trunk to extra-x86_64
[arch-packages.git] / python-pip / trunk / PKGBUILD
blob04a041dc7c04c1088a321b169f7192a97d787488
1 # Maintainer: David Runge <dvzrv@archlinux.org>
2 # Maintainer: Felix Yan <felixonmars@archlinux.org>
3 # Contributor: Dan McGee <dan@archlinux.org>
4 # Contributor: Eli Schwartz <eschwartz@archlinux.org>
5 # Contributor: Sebastien Binet <binet@lblbox>
7 _name=pip
8 pkgname=python-pip
9 pkgver=22.2.2
10 pkgrel=1
11 pkgdesc="The PyPA recommended tool for installing Python packages"
12 url="https://pip.pypa.io/"
13 arch=(any)
14 license=(MIT)
15 # packages required to devendor pip: https://github.com/pypa/pip/tree/main/src/pip/_vendor
16 _vendored=(
17   python-cachecontrol
18   python-certifi
19   python-chardet
20   python-colorama
21   python-distlib
22   python-distro
23   python-idna
24   python-msgpack
25   python-packaging
26   python-pep517
27   python-platformdirs
28   python-pygments
29   python-pyparsing
30   python-requests
31   python-resolvelib
32   python-rich
33   python-setuptools
34   python-six
35   python-tenacity
36   python-tomli
37   python-typing-extensions
38   python-urllib3
39   python-webencodings
41 # add these until https://github.com/pypa/pip/issues/5354#issuecomment-672678167 is resolved
42 _vendored_optional=(
43   python-pyopenssl
45 depends=("${_vendored[@]}" "${_vendored_optional[@]}")
46 makedepends=(
47   python-build
48   python-installer
49   python-myst-parser
50   python-setuptools
51   python-sphinx
52   python-sphinx-copybutton
53   python-sphinx-inline-tabs
54   python-sphinxcontrib-towncrier
55   python-wheel
57 checkdepends=(
58   git
59   python-cryptography
60   python-freezegun
61   python-pytest
62   python-pytest-rerunfailures
63   python-pytest-xdist
64   python-scripttest
65   python-setuptools
66   python-tomli-w
67   python-virtualenv
68   python-werkzeug
69   python-wheel
70   subversion
72 source=(
73   $_name-$pkgver.tar.gz::https://github.com/pypa/$_name/archive/$pkgver.tar.gz
74   $_name-22.1.2-devendor.patch
76 sha512sums=('bd59e28b55475b77a8f11ea771cbad3b2602ff974e219f9a55288963a9522c9279a5b00fde40fb65cfebefae0e905d3da3c06fe50b402aa5326b25f70a98a015'
77             '90f07252786d765c8ba7ce12915ed9434d3696addb8e5cfff298f280b9f499ad6836a158c9f515a51fc7373f1a77b9eb550b7855609114b041aa7bc5b2b821ae')
78 b2sums=('2179b0d3f5f05bbd678f1785b4dbc0613078c09c83b45faa62d766182dfeb564095abda809ed99f45644abcb06c125efc528aeaed3ad40ab1c9e8972e33ccbb2'
79         '892455034738c6c7a74cd7c136c0650f9c4eb54dd4708cf43d2e17ecbd9904adb567c9c3d5a05865048645ad3aac65406a82d23af43fd3889d9290b66d89ead5')
81 shopt -s extglob
82 prepare() {
83   # set DEBUNDLED to True
84   patch -Np1 -d $_name-$pkgver -i ../$_name-22.1.2-devendor.patch
86   # remove vendored files, except __init__.py
87   rm -frv $_name-$pkgver/src/pip/_vendor/!(__init__.py)
88   shopt -u extglob
91 build() {
92   cd $_name-$pkgver
94   python -m build --wheel --no-isolation
96   cd docs/
97   PYTHONPATH="$srcdir/$_name-$pkgver/src/" python pip_sphinxext.py
98   PYTHONPATH="$srcdir/$_name-$pkgver/src/" sphinx-build -b man -d build/doctrees/man man build/man -c html
101 check() {
102   local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
103   local _deselected=(
104     # deselect tests that would require python-pip in checkdepends (may or may not work due to devendored dependencies when python-pip is updated)
105     --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_with_source_dir_obtains_commit_id
106     --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_without_source_dir
107     --deselect tests/unit/test_wheel_builder.py::test_should_cache_git_sha
108   )
110   cd $_name-$pkgver
111   # install to temporary location
112   python -m installer --destdir=test_dir dist/*.whl
113   export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
114   pytest -vv -m unit "${_deselected[@]}"
117 package() {
118   local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
120   cd $_name-$pkgver
121   python -m installer --destdir="$pkgdir" dist/*.whl
123   install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
124   install -vDm 644 docs/build/man/*.1 -t "$pkgdir/usr/share/man/man1/"
125   install -vDm 644 {NEWS,README}.rst -t "$pkgdir/usr/share/doc/$pkgname/"
127   # NOTE: zsh completion does not work: https://bugs.archlinux.org/task/65349#comment187166
128   PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --bash | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip
129   PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --fish | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/fish/vendor_completions.d/pip.fish