archrelease: copy trunk to extra-x86_64
[arch-packages.git] / python-pip / trunk / PKGBUILD
blob492f09d9659e2d594c609c070053b5cfc27d2d3c
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=23.1.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 depends=(
16   python
17   python-attrs  # for vendored rich
18   python-cryptography  # for vendored requests and urllib3
19   python-wheel  # for internal misc utils
21 makedepends=(
22   python-build
23   python-installer
24   python-myst-parser
25   python-setuptools
26   python-sphinx
27   python-sphinx-copybutton
28   python-sphinx-inline-tabs
29   python-sphinxcontrib-towncrier
31 checkdepends=(
32   git
33   python-freezegun
34   python-pytest
35   python-pytest-rerunfailures
36   python-pytest-xdist
37   python-scripttest
38   python-tomli-w
39   python-virtualenv
40   python-werkzeug
41   subversion
43 source=(https://github.com/pypa/$_name/archive/$pkgver/$_name-$pkgver.tar.gz)
44 sha512sums=('b33070cb59a1258904a60b48ec8abfd9e316c5f87681fea13d89ddf6d516afac10965ae1db54fea299a0a72f98602ce02e8b3be46f239e857db84866045730e1')
45 b2sums=('511ac1a9405e377ccb2525e89676f4a63f138aa526d40e76f4d9681139d94db1f92772beab1a647654c17abc6bee09f52cf4c4f4484716874194565fda07d056')
47 build() {
48   cd $_name-$pkgver
50   python -m build --wheel --no-isolation
52   cd docs/
53   PYTHONPATH="$srcdir/$_name-$pkgver/src/" python pip_sphinxext.py
54   PYTHONPATH="$srcdir/$_name-$pkgver/src/" sphinx-build -b man -d build/doctrees/man man build/man -c html
57 check() {
58   local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
59   local _deselected=(
60     # deselect tests that would require python-pip in checkdepends (may or may not work due to devendored dependencies when python-pip is updated)
61     --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_with_source_dir_obtains_commit_id
62     --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_without_source_dir
63     --deselect tests/unit/test_wheel_builder.py::test_should_cache_git_sha
64   )
66   cd $_name-$pkgver
67   # install to temporary location
68   python -m installer --destdir=test_dir dist/*.whl
69   export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
70   pytest -vv -m unit "${_deselected[@]}" tests/
73 package() {
74   local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
76   cd $_name-$pkgver
77   python -m installer --destdir="$pkgdir" dist/*.whl
79   install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
80   install -vDm 644 docs/build/man/*.1 -t "$pkgdir/usr/share/man/man1/"
81   install -vDm 644 {NEWS,README}.rst -t "$pkgdir/usr/share/doc/$pkgname/"
83   # NOTE: zsh completion does not work: https://bugs.archlinux.org/task/65349#comment187166
84   PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --bash | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip
85   PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --fish | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/fish/vendor_completions.d/pip.fish