archrelease: copy trunk to extra-x86_64
[arch-packages.git] / python-pip / repos / extra-any / PKGBUILD
blob994e9d6b6a3d11d0f71cbd4a2f12e36cd58e13ea
1 # Maintainer: Dan McGee <dan@archlinux.org>
2 # Contributor: Eli Schwartz <eschwartz@archlinux.org>
3 # Contributor: Sebastien Binet <binet@lblbox>
5 pkgname=python-pip
6 pkgver=21.0
7 pkgrel=1
8 pkgdesc="The PyPA recommended tool for installing Python packages"
9 url="https://pip.pypa.io/"
10 arch=('any')
11 license=('MIT')
12 _deps=('appdirs' 'cachecontrol' 'colorama' 'contextlib2' 'distlib' 'distro' 'html5lib'
13        'packaging' 'pep517' 'progress' 'requests' 'retrying' 'resolvelib' 'setuptools' 'six' 'toml'
14        # add these until https://github.com/pypa/pip/issues/5354#issuecomment-672678167 is resolved
15        'pyopenssl')
16 depends=("${_deps[@]/#/python-}")
17 makedepends=("${_deps[@]/#/python-}" 'python-sphinx'
18              'python-sphinx-inline-tabs' 'python-sphinxcontrib-towncrier')
19 checkdepends=('python-pytest-runner' 'python-scripttest' 'python-virtualenv' 'python-pretend'
20               'python-yaml' 'python-mock' 'python-freezegun' 'python-cryptography' 'python-pip'
21               'python-wheel' 'python-werkzeug' 'python-csv23' 'git' 'subversion')
22 source=("pip-${pkgver}.tar.gz::https://github.com/pypa/pip/archive/${pkgver}.tar.gz"
23         resolvelib-0.5.5.patch)
24 sha512sums=('ac77a7204423f1fdc3a4d328dab1860258efccde0123cff3217f357637c4ce3d85772ab81a230122ff813be2cfa40f2862e5d499390289efe1dcde3a31a42264'
25             'f339a20e965c583c1dc741d9fff90749aab049d591f0ac974e2187d4f41842661802b96266e8e35454b65d61d65c337a770d58b81119af07483fde0eda48001b')
27 shopt -s extglob
28 prepare() {
29   cd pip-$pkgver
31   # Backported from:
32   # https://github.com/pypa/pip/commit/0d39ae9734d054c25e48e2da7ddb76545e5de330
33   patch -p1 -i ../resolvelib-0.5.5.patch
35   # Remove certifi usage
36   sed -i 's|from pip._vendor.certifi import where|where = lambda: "/etc/ssl/certs/ca-certificates.crt"|' src/pip/_internal/commands/debug.py
38   rm -rf src/pip/_vendor/!(__init__.py)
39   sed -i -e 's/DEBUNDLED = False/DEBUNDLED = True/' \
40             src/pip/_vendor/__init__.py
43 build() {
44   cd pip-$pkgver
46   python setup.py build
48   cd docs/
49   PYTHONPATH="$srcdir/pip-$pkgver/src/" python pip_sphinxext.py
50   PYTHONPATH="$srcdir/pip-$pkgver/src/" sphinx-build -W -b man -d build/doctrees/man man build/man -c html
51   mkdir -p build/man-pip2
52   cd build/man
53   for manfile in *; do
54     sed 's/pip/pip2/g;s/PIP/PIP2/g' $manfile > ../man-pip2/${manfile/pip/pip2}
55   done
58 check() {
59   cd "$srcdir"/pip-$pkgver
60   pip wheel -w tests/data/common_wheels -r tools/requirements/tests-common_wheels.txt
61   python setup.py install --root="$PWD/tmp_install" --optimize=1
62   # appdirs: https://github.com/pypa/pip/issues/7784
63   # build_env: TODO weird looking errors
64   # virtualenv: https://github.com/pypa/pip/issues/8273
65   PYTHONPATH="$PWD/tmp_install/usr/lib/python3.10/site-packages" PATH="$PWD/tmp_install/usr/bin:$PATH" \
66     python -m pytest -m unit --junit-xml=junit/unit-test.xml --deselect tests/unit/test_appdirs.py::TestSiteConfigDirs::test_site_config_dirs_linux \
67                                                              --deselect tests/unit/test_appdirs.py::TestSiteConfigDirs::test_site_config_dirs_linux_override \
68                                                              --deselect tests/unit/test_appdirs.py::TestSiteConfigDirs::test_site_config_dirs_linux_empty \
69                                                              --deselect tests/unit/test_appdirs.py::TestUserDataDir::test_user_data_dir_osx \
70                                                              --deselect tests/unit/test_appdirs.py::TestUserConfigDir::test_user_config_dir_osx \
71                                                              --deselect tests/unit/test_build_env.py::test_build_env_requirements_check \
72                                                              --deselect tests/unit/test_build_env.py::test_build_env_overlay_prefix_has_priority \
73                                                              --deselect tests/unit/test_build_env.py::test_build_env_isolation \
74                                                              --deselect tests/unit/test_build_env.py::test_build_env_allow_only_one_install \
75                                                              --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_with_source_dir_obtains_commit_id \
76                                                              --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_without_source_dir \
77                                                              --deselect tests/unit/test_wheel_builder.py::test_should_cache_git_sha \
78                                                              --deselect tests/unit/resolution_resolvelib/test_requirement.py::test_new_resolver_full_resolve
81 package() {
82   cd pip-$pkgver
83   python setup.py install --prefix=/usr --root="$pkgdir"
85   install -D -m644 LICENSE.txt \
86           "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
88   install -Dm644 -t "$pkgdir"/usr/share/man/man1 docs/build/man/*
90   PYTHONPATH="$pkgdir"/usr/lib/python3.10/site-packages "$pkgdir"/usr/bin/pip completion --bash \
91     | install -Dm644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip
92   PYTHONPATH="$pkgdir"/usr/lib/python3.10/site-packages "$pkgdir"/usr/bin/pip completion --fish \
93     | install -Dm644 /dev/stdin "$pkgdir"/usr/share/fish/vendor_completions.d/pip.fish