summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bd956b535366ea1afbdaa9f229eeafa8189f8a4c (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
# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>

pkgname=linode-cli-git
pkgver=5.41.2.r17.g2fbcfa6
pkgrel=1
pkgdesc="The Linode Command Line Interface (development version)"
arch=('any')
url="https://github.com/linode/linode-cli"
license=('BSD')
depends=('python-rich' 'python-requests' 'python-yaml' 'python-setuptools' 'python-openapi3')
makedepends=('git' 'python-build' 'python-installer' 'python-wheel')
optdepends=('python-boto: for obj plugin')
provides=(${pkgname%-git})
conflicts=(${pkgname%-git})
source=(${pkgname%-git}::'git+https://github.com/linode/linode-cli.git'
        ${pkgname%-git}-$pkgver-openapi.yaml::'https://www.linode.com/docs/api/openapi.yaml')
sha256sums=('SKIP'
            'SKIP')

pkgver() {
	cd "${pkgname%-git}"
	git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "${pkgname%-git}"
	python -m linodecli bake ../${pkgname%-git}-$pkgver-openapi.yaml --skip-config
	cp data-3 linodecli/
	python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
	local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
	cd "${pkgname%-git}"
	python -m installer --destdir="${pkgdir}" dist/*.whl
	install -vDm0644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
	install -vDm0644 linode-cli.sh "${pkgdir}/usr/share/bash-completion/completions/linode-cli"
	rm -rv "${pkgdir}/$site_packages/etc/"
}