alr-repo/python3-poetry/alr.sh

94 lines
2.7 KiB
Bash

name='python3-poetry'
version='1.8.3'
release='4'
desc='Python dependency management and packaging made easy'
homepage='https://python-poetry.org'
maintainer="Евгений Храмов <xpamych@yandex.ru>"
architectures=('all')
license=('MIT')
provides=('poetry')
conflicts=('poetry')
deps=(
'python3-build'
'python3-CacheControl'
'python3-cachy'
'python3-cleo'
'python3-crashtest'
'python3-dulwich'
'python3-filelock'
'python3-html5lib'
'python3-installer'
'python3-jsonschema'
'python3-keyring'
'python3-lockfile'
'python3-packaging'
'python3-pexpect'
'python3-pkginfo'
'python3-platformdirs'
'python3-poetry-core'
'python3-poetry-plugin-export'
'python3-pyproject-hooks'
'python3-requests'
'python3-requests-toolbelt'
'python3-shellingham'
'python3-tomlkit'
'python3-trove-classifiers'
'python3-urllib3'
'python3-virtualenv'
)
build_deps=(
'python3-deepdiff' # not mentioned but required
'python-psutil' # for python-pytest-xdist
'python3-httpretty'
'python-pip' # not mentioned but required
'python-pytest'
'python-pytest-mock'
'python3-pytest-randomly'
'python-pytest-xdist'
)
opt_deps=('python-pip: to use pip with virtual environments')
opt_deps_redos=('python3-pip: to use pip with virtual environments')
sources=("https://github.com/python-poetry/poetry/releases/download/${version}/poetry-${version}.tar.gz")
checksums=('SKIP')
prepare() {
cd "poetry-$version"
# Unpin crashtest which we have packaged at 0.4.0
# https://bugs.archlinux.org/task/75733
# Also unpin requests-toolbelt
# https://github.com/python-poetry/poetry/pull/7893
sed -i -e '/^crashtest/s/\^/>=/' -e '/^requests-toolbelt/s/,<0.11.0//' pyproject.toml
}
build() {
site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
cd "poetry-$version"
python -m build -wn
# install to tmp dir for tests and generate completions
python -m installer --destdir=test_dir dist/*.whl
export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
export PATH="$PWD/test_dir/usr/local/bin:$PATH"
poetry completions bash > poetry.bash
poetry completions zsh > poetry.zsh
poetry completions fish > poetry.fish
}
check() {
local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
cd "poetry-$version"
export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
pytest -vv tests
}
package() {
cd "poetry-$version"
python -m installer -d "$pkgdir" dist/*.whl
install-license ./LICENSE ./poetry/LICENSE
install -vDm 644 poetry.bash "$pkgdir/usr/share/bash-completion/completions/poetry"
install -vDm 644 poetry.zsh "$pkgdir/usr/share/zsh/site-functions/_poetry"
install -vDm 644 poetry.fish -t "$pkgdir/usr/share/fish/vendor_completions.d/"
}