summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 485be0d2dd4587c43a217e9ab81c0e76208e0be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Maintainer: Pellegrino Prevete <pellegrinoprevete@gmail.com>
# Contributor: Alireza Ayinmehr <alireza.darksun@gmail.com>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Sebastien Binet <binet@lblbox>

_py="python"
_name="pip"
pkgname="${_py}-${_name}-git"
pkgver=23.0.r34.g852deddb9
pkgrel=1
pkgdesc="The PyPA recommended tool for installing Python packages"
_pypi="https://github.com/pypa"
url="${_pypi}/${_name}"
arch=('any')
license=('MIT')
depends=(
  python
  python-attrs  # for vendored rich
  python-cryptography  # for vendored requests and urllib3
  python-wheel  # for internal misc utils
)
makedepends=(
  python-build
  python-installer
  python-myst-parser
  python-setuptools
  python-sphinx
  python-sphinx-copybutton
  python-sphinx-inline-tabs
  python-sphinxcontrib-towncrier
)
checkdepends=(
  git
  python-freezegun
  python-pytest
  python-pytest-rerunfailures
  python-pytest-xdist
  python-scripttest
  python-tomli-w
  python-virtualenv
  python-werkzeug
  subversion
)
conflicts=("${_py}-${_name}")
source=("${_name}::git+${url}")
sha512sums=('SKIP')

pkgver() {
  cd "${_name}"
  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "${_name}"
  python -m build --wheel --no-isolation

  cd docs/
  PYTHONPATH="$srcdir/${_name}/src/" python pip_sphinxext.py
  PYTHONPATH="$srcdir/${_name}/src/" sphinx-build -b man -d build/doctrees/man man build/man -c html
}

package() {
  local _site_packages

  cd "${_name}"
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 docs/build/man/*.1 -t "$pkgdir/usr/share/man/man1/"
  install -vDm 644 {NEWS,README}.rst -t "$pkgdir/usr/share/doc/$pkgname/"
  _site_packages="$(python -c "from distutils import sysconfig; print(sysconfig.get_python_lib())")"

  # NOTE: zsh completion does not work: https://bugs.archlinux.org/task/65349#comment187166
  PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --bash | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip
  PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --fish | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/fish/vendor_completions.d/pip.fish
}