summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 13fe951025bc061532cc8cb6a8892641b6b8e587 (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
# Maintainer: Claudia Pellegrino <aur ät cpellegrino.de>

pkgname='python-pygreat'
_gitpkgname=libgreat
pkgver=2024.0.1
pkgrel=1
pkgdesc='Host-side drivers for communication with embedded devices'
arch=('any')
url='https://github.com/greatscottgadgets/libgreat'
license=('BSD-3-Clause')
depends=(
  'python'
  'python-future'
  'python-libusb1'
  'python-pyusb'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-pyproject-patcher'
  'python-setuptools'
  'python-sphinx'
  'python-sphinx_rtd_theme'
  'python-wheel'
)

source=(
  "${_gitpkgname}-${pkgver}.tar.gz::https://github.com/greatscottgadgets/libgreat/archive/v${pkgver}.tar.gz"
)

sha512sums=(
  '099af99347b24f5ee4549320757aea0238bc257312ea3161192615c81e0d77ffe272a665cfcee144aae8ec21c693b19034a286a790afdee99b8132c420ecf98c'
)

prepare() {
  cd "${_gitpkgname}-${pkgver}"

  echo >&2 'Pinning version number'
  export pkgver
  python << 'EOF'
from pyproject_patcher import patch_in_place
with patch_in_place('host/pyproject.toml') as toml:
    toml.set_project_version_from_env('pkgver')
    toml.tools.setuptools_git_versioning.remove()
EOF
}

build() {
  cd "${_gitpkgname}-${pkgver}"
  python -m build --wheel --no-isolation host
}

package() {
  cd "${_gitpkgname}-${pkgver}"

  echo >&2 'Packaging the wheel'
  python -I -m installer --destdir="${pkgdir}" host/dist/*.whl

  echo >&2 'Packaging the documentation'
  install -D -m 644 -t "${pkgdir}/usr/share/doc/${pkgname}" \
    README.md

  echo >&2 'Packaging the license'
  install -D -m 644 -t "${pkgdir}/usr/share/licenses/${pkgname}" \
    LICENSE
}