aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-pip/APKBUILD
blob: bebe7d3aad5c6bac3a5effd0a7f48c3cd82b3484 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-pip
pkgver=20.3.4
pkgrel=0
pkgdesc="Tool for installing and managing Python packages"
url="http://www.pip-installer.org"
arch="noarch"
license="MIT"
depends="
	py3-appdirs
	py3-cachecontrol
	py3-colorama
	py3-contextlib2
	py3-distlib
	py3-distro
	py3-html5lib
	py3-msgpack
	py3-packaging
	py3-parsing
	py3-pep517
	py3-progress
	py3-requests
	py3-retrying
	py3-setuptools
	py3-six
	py3-toml
	py3-webencodings
	python3
	"
makedepends="
	py3-sphinx
	py3-sphinx-inline-tabs
	"
checkdepends="
	py3-cryptography
	py3-freezegun
	py3-mock
	py3-pretend
	py3-pytest
	py3-yaml
	py3-scripttest
	py3-virtualenv
	py3-werkzeug
	"
subpackages="
	$pkgname-doc
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-bash-completion:bashcomp:noarch
	"
source="https://github.com/pypa/pip/archive/$pkgver/pip-$pkgver.tar.gz"
builddir="$srcdir/pip-$pkgver"

provides="py-pip=$pkgver-r$pkgrel" # Backwards compatibility
replaces="py-pip" # Backwards compatibility

prepare() {
	default_prepare

	# Remove certifi usage
	sed -i 's|from pip._vendor.certifi import where|where = lambda: "/etc/ssl/certs/ca-certificates.crt"|' src/pip/_internal/commands/debug.py

	# Do not use furo as HTML theme in docs
	# furo is not available in Alpine
	sed -i '/html_theme = "furo"/d' docs/html/conf.py

	# Upstream uses a Python 2/3 compatibility library for csv with Python 3 semantics in tests
	# We only target Python 3 and csv23 is not (yet) packaged
	# As of 20.1b1, this workaround was sufficient to get around the missing dependency
	sed -i -e 's/csv23/csv/g' tests/lib/wheel.py
}

build() {
	python3 setup.py build

	# Build manpages
	PYTHONPATH="$builddir/src/" sphinx-build -b html docs/html docs/build/html
	PYTHONPATH="$builddir/src/" sphinx-build -b man docs/man docs/build/man -c docs/html
}

check() {
	# --deselect'ed and -k'ed tests are not compatible with the latest virtualenv
	# These files contain almost 500 tests so we should enable them back
	# as soon as pip will be compatible upstream
	# https://github.com/pypa/pip/pull/8441
	PYTHONPATH="$PWD/build/lib" pytest -m 'not network' \
		-k "not test_from_link_vcs_with_source_dir_obtains_commit_id and not test_from_link_vcs_without_source_dir and not test_should_cache_git_sha" \
		--deselect tests/functional \
		--deselect tests/lib/test_lib.py \
		--deselect tests/unit/test_build_env.py
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"

	install -Dm644 docs/build/man/* -t "$pkgdir"/usr/share/man/man1

	local _py3ver=$(python3 -c 'import sys; print("{}.{}".format(sys.version_info.major, sys.version_info.minor))')
	PYTHONPATH="$pkgdir"/usr/lib/python$_py3ver/site-packages "$pkgdir"/usr/bin/pip \
		completion --bash | \
		install -Dm644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip

	PYTHONPATH="$pkgdir"/usr/lib/python$_py3ver/site-packages "$pkgdir"/usr/bin/pip \
		completion --zsh | \
		install -Dm644 /dev/stdin "$pkgdir"/usr/share/zsh/site-functions/_pip
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	amove usr/share/bash-completion/completions
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	amove usr/share/zsh/site-functions
}

sha512sums="30e9d6d5dfc54681ca07e5701e26cdde202326848f6b37a013fe1fcc38402efa81284e15d7750de97d871e0da995cf5363e5c9676a036d271ff06bb0052cc1ec  pip-20.3.4.tar.gz"