db-move: moved webkitgtk-6.0 from [testing] to [extra] (x86_64)
[arch-packages.git] / python-virtualenv / trunk / PKGBUILD
blob6f99b58fa4f19d65f5c0bb2239f51de13feaa730
1 # Maintainer: Felix Yan <felixonmars@archlinux.org>
2 # Contributor: Dan McGee <dan@archlinux.org>
3 # Contributor: Daniele Paolella <dp@mcrservice.it>
5 pkgname=python-virtualenv
6 pkgver=20.21.0
7 pkgrel=1
8 pkgdesc="Virtual Python Environment builder"
9 url="https://virtualenv.pypa.io/"
10 arch=('any')
11 license=('MIT')
12 depends=(
13   'python'
14   'python-distlib'
15   'python-filelock'
16   'python-platformdirs'
18 makedepends=(
19   'python-build'
20   'python-installer'
21   'python-hatchling'
22   'python-hatch-vcs'
23   'python-importlib-metadata'
24   'python-sphinx'
25   'python-sphinx-argparse'
26   'python-sphinxcontrib-towncrier'
27   'python-wheel'
28   'towncrier'
30 checkdepends=(
31   'fish'
32   'python-coverage'
33   'python-flaky'
34   'python-pip'
35   'python-pytest-freezegun'
36   'python-pytest-mock'
37   # 'tcsh'  # NOTE: randomly hangs tests (e.g. tests/unit/test_util.py::test_reentrant_file_lock_is_thread_safe)
38   'xonsh'
40 replaces=('virtualenv')
41 conflicts=('virtualenv')
42 options=('!makeflags')
43 source=(https://github.com/pypa/virtualenv/archive/$pkgver/$pkgname-$pkgver.tar.gz)
44 sha512sums=('c02ba29677c3b6405d2849bba7243b7a61a49f83b0d309a288876754762f81a1d111ae5176e4c20623e263ceef73c4c0c76fd7a84043ee8a220b5620b31fc2e7')
45 b2sums=('5e8ac9e29af0251a247b7f80465e975c13fcaa722ad4859cba046783819a2540307f31a3799146316a07490e4c55fca0a77ee84238865412517832766e2ee200')
47 export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
49 prepare() {
50   # workaround pip vendorod certifi
51   sed -i "s|pkgutil.get_data(\"pip._vendor.certifi\", \"cacert.pem\")|open(os.path.join('/etc/ssl/certs/ca-certificates.crt'), 'rb').read()|" virtualenv-$pkgver/tests/conftest.py
54 build() {
55   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
57   cd virtualenv-$pkgver
58   python -m build --wheel --no-isolation
59   # NOTE: install to tmp dir for documentation and tests
60   python -m installer --destdir=test_dir dist/*.whl
61   export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
62   sphinx-build -b man docs docs/_build/man
65 check() {
66   local pytest_options=(
67     -vv
68     # tests try to find python2
69     --deselect tests/unit/create/test_creator.py::test_py_pyc_missing[True-False]
70     --deselect tests/unit/create/test_creator.py::test_py_pyc_missing[False-False]
71     --deselect tests/unit/discovery/py_info/test_py_info.py::test_fallback_existent_system_executable
72   )
73   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
75   cd virtualenv-$pkgver
76   export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
77   pytest "${pytest_options[@]}"
80 package() {
81   cd virtualenv-$pkgver
82   python -m installer --destdir="$pkgdir" dist/*.whl
83   install -Dm 644 docs/_build/man/virtualenv.1 -t "${pkgdir}/usr/share/man/man1/"
84   ln -s virtualenv.1.gz "${pkgdir}/usr/share/man/man1/virtualenv3.1.gz"
86   # link to a version with 3 suffix as well
87   ln "$pkgdir/usr/bin/virtualenv" "$pkgdir/usr/bin/virtualenv3"
89   install -D -m644 LICENSE -t \
90     "$pkgdir"/usr/share/licenses/$pkgname/