upgpkg: ufw 0.36.2-1
[ArchLinux/community.git] / python-spsdk / trunk / PKGBUILD
blob664546ef5c6903b549c6cc2711e7869a95a427cc
1 # Maintainer: David Runge <dvzrv@archlinux.org>
3 _name=spsdk
4 pkgname=python-spsdk
5 pkgver=1.8.0
6 pkgrel=2
7 pkgdesc="NXP Secure Provisioning SDK"
8 arch=(any)
9 url="https://github.com/NXPmicro/spsdk"
10 license=(BSD)
11 depends=(
12   python-asn1crypto
13   python-astunparse
14   python-bincopy
15   python-bitstring
16   python-click
17   python-click-command-tree
18   python-click-option-group
19   python-cmsis-pack-manager
20   python-colorama
21   python-commentjson
22   python-crcmod
23   python-cryptography
24   python-deepmerge
25   python-fastjsonschema
26   python-hexdump
27   python-jinja
28   python-libusbsio
29   python-oscrypto
30   python-pycryptodome
31   python-pylink-square
32   python-pyocd
33   python-pyserial
34   python-ruamel-yaml
35   python-sly
36   python-typing-extensions
38 makedepends=(python-build python-installer python-setuptools python-wheel)
39 checkdepends=(
40   python-jsonschema
41   python-pytest
42   python-voluptuous
43   python-pyyaml
45 # pypi sdist tarball has no tests: https://github.com/NXPmicro/spsdk/issues/37
46 # source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz")
47 source=(
48   $_name-$pkgver.tar.gz::https://github.com/NXPmicro/$_name/archive/refs/tags/$pkgver.tar.gz
49   $pkgname-1.6.0-remove_pypemicro.patch
51 sha512sums=('ab6c404dae2994eec1a2016d7e187fc74fe3b6b50e8f431ca8003ccb5dbcefbdd55ecfa683062b94a85dee675da46483cc58e2c42b50afad83ebd60e22306108'
52             '7bfb3739053284ba0b4084c1f84e37e307233fa7b52adf403fa5c574393d71e08ea02bdc927106b036d1055f6efd6c326b534d697c1d5f6c097def53dbafc560')
53 b2sums=('0f8556e2b9f5e6401fcfb563017184eb8112f4f7ce5cb5c98831f5ba156189618bfe0bec74397ed0e77706bd1aea8342f64b8e8913918773e17170842a34237d'
54         '2c68116494b5e7ff51e59ec79dd3e354e2a8035ab35e29b27a097d7baa47e48c71a2cdac651920c76cd29097c5e8710e74106e41a4b3d5f543e259ef7404beac')
56 prepare() {
57   cd $_name-$pkgver
58   # remove all version pinning and overly explicit version bounds
59   # https://github.com/NXPmicro/spsdk/issues/35
60   sed -e 's|>=.*||g;s|==.*||g;s|~=.*||g;s|<.*||g' -i requirements{,-develop}.txt
61   # remove dependency on python-pypemicro as it vendors prebuilt shared libraries
62   # https://github.com/NXPmicro/spsdk/issues/30
63   # https://github.com/NXPmicro/pypemicro/issues/10
64   sed '/pypemicro/d' -i requirements.txt
65   patch -Np1 -i ../$pkgname-1.6.0-remove_pypemicro.patch
66   # remove dependency on python-pyocd-pemicro as it vendors prebuilt shared libraries via python-pypemicro
67   # https://github.com/pyocd/pyOCD/issues/1319
68   # https://github.com/NXPmicro/spsdk/issues/30
69   # https://github.com/NXPmicro/pypemicro/issues/10
70   sed '/pyocd-pemicro/d' -i requirements.txt
73 build() {
74   cd $_name-$pkgver
75   python -m build --wheel --no-isolation
78 check() {
79   local _deselected=()
81   cd $_name-$pkgver
82   # ignore failing tests due to incompatible bincopy: https://github.com/NXPmicro/spsdk/issues/38
83   pytest -v --ignore tests/elftosb/test_elftosb_mbi.py -k "not test_parse_image_file_invalid and not test_load_binary_image"
86 package() {
87   cd $_name-$pkgver
88   python -m installer --destdir="$pkgdir" dist/*.whl
89   install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
90   install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"