upgpkg: ufw 0.36.2-1
[ArchLinux/community.git] / python-poetry / trunk / PKGBUILD
blobf52c6be50b182d5e1939bb22138bb7f359bed863
1 # Maintainer: Caleb Maclennan <caleb@alerque.com>
2 # Contributor: David Runge <dvzrv@archlinux.org>
3 # Contributor: David JoaquĆ­n Shourabi Porcel <david@djsp.eu>
4 # Contributor: Sven-Hendrik Haase <svenstaro@gmail.com>
5 # Contributor: Eli Schwartz <eschwartz@archlinux.org>
7 _pkgname=poetry
8 pkgname=python-poetry
9 pkgver=1.4.2
10 pkgrel=3
11 pkgdesc='Python dependency management and packaging made easy'
12 arch=(any)
13 url=https://python-poetry.org
14 license=(MIT)
15 _deps=(build
16        cachecontrol
17        cachy
18        cleo
19        crashtest
20        dulwich
21        filelock
22        html5lib
23        installer
24        jsonschema
25        keyring
26        lockfile
27        packaging
28        pexpect
29        pkginfo
30        platformdirs
31        poetry-core
32        poetry-plugin-export
33        pyproject-hooks
34        requests
35        requests-toolbelt
36        shellingham
37        tomlkit
38        trove-classifiers
39        urllib3
40        virtualenv)
41 depends=(
42   python
43   "${_deps[@]/#/python-}"
45 checkdepends=(
46   python-deepdiff  # not mentioned but required
47   python-psutil  # for python-pytest-xdist
48   python-httpretty
49   python-pip  # not mentioned but required
50   python-pytest
51   python-pytest-mock
52   python-pytest-randomly
53   python-pytest-xdist
55 optdepends=(
56   'python-pip: to use pip with virtual environments'
58 provides=(poetry)
59 _archive="$_pkgname-$pkgver"
60 source=("https://github.com/$pkgname/$_pkgname/archive/$pkgver/$_archive.tar.gz")
61 sha256sums=('8cdbad22dfd11ca9c7e37bcafe18ae931b80e0776adbe6df8d24091bd2b23eff')
63 prepare() {
64   cd "$_archive"
65   # Unpin crashtest which we have packaged at 0.4.0
66   # https://bugs.archlinux.org/task/75733
67   # Also unpin requests-toolbelt
68   # https://github.com/python-poetry/poetry/pull/7893
69   sed -i -e '/^crashtest/s/\^/>=/' -e '/^requests-toolbelt/s/,<0.11.0//' pyproject.toml
72 build() {
73   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
74   cd "$_archive"
75   python -m build -wn
77   # install to tmp dir for tests and generate completions
78   python -m installer --destdir=test_dir dist/*.whl
79   export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
80   export PATH="$PWD/test_dir/usr/bin:$PATH"
81   poetry completions bash > poetry.bash
82   poetry completions zsh > poetry.zsh
83   poetry completions fish > poetry.fish
86 check() {
87   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
89   cd "$_archive"
90   export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
91   pytest -vv tests
94 package() {
95   cd "$_archive"
96   python -m installer -d "$pkgdir" dist/*.whl
97   install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
98   install -vDm 644 $_pkgname.bash "$pkgdir/usr/share/bash-completion/completions/$_pkgname"
99   install -vDm 644 $_pkgname.zsh "$pkgdir/usr/share/zsh/site-functions/_$_pkgname"
100   install -vDm 644 $_pkgname.fish -t "$pkgdir/usr/share/fish/vendor_completions.d/"