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

pkgname=python-pyfwup
_gitpkgname=pyfwup
pkgver=0.5.2
pkgrel=1
pkgdesc='Python Firmware Upgrader, a DFU (and similar) utility for Python'
arch=('any')
url='https://github.com/greatscottgadgets/pyfwup'
license=('BSD-3-Clause')
depends=(
  'python'
  'python-pyusb'
  'python-tqdm'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-pyproject-patcher'
  'python-setuptools'
  'python-wheel'
)

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

sha512sums=('e1c0b36d08a5255f5a276e51370f52877474c3f81471d004038fe31a8d8346f80e5e23eede355c13eebbb6b6576eaa852e0c1e58e47249bbb852f31659b4b25c')

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

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

build() {
  cd "${_gitpkgname}-${pkgver}"
  echo >&2 'Building wheel'
  python -m build --wheel --no-isolation
}

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

  echo >&2 'Packaging the wheel'
  python -I -m installer --destdir="${pkgdir}" 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
}