Skip to content

Commit

Permalink
update python-cmsis-pack-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
taotieren committed Nov 28, 2024
1 parent b9d8793 commit 4e122cf
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 0 deletions.
78 changes: 78 additions & 0 deletions aur-repo/python-cmsis-pack-manager/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Maintainer: David Runge <dvzrv@archlinux.org>

pkgname=python-cmsis-pack-manager
_name="${pkgname#python-}"
pkgver=0.5.3
pkgrel=3
pkgdesc="A Rust and Python module for handling CMSIS Pack files"
arch=(x86_64)
url="https://github.com/pyocd/cmsis-pack-manager"
license=(Apache-2.0)
depends=(
gcc-libs
glibc
python
python-appdirs
python-cffi
python-pyyaml
)
makedepends=(
git
python-build
python-installer
python-maturin
python-wheel
rust
)
checkdepends=(
python-hypothesis
python-jinja
python-pytest
)
# disable LTO until ring can be built with it: https://github.com/briansmith/ring/issues/1444
options=(!lto)
source=(
git+$url.git#tag=v$pkgver
$pkgname-0.5.3-update_maturin.patch
)
sha512sums=('7ed9d3c5f48134bc89327c6673279c55d06f0e15f26e54ef891ba9c676d661a0730d14808b305a11cf1d1814dfab9d1500461330758a4f9afb17f4e7beac6c8a'
'429c9c7e408d9fb341291379eb9f716f5d96df12bced88c26ef609647017a1d494701e96c6bd3bf5477a68252329103f5173c9db9fd8705dd7af028bedc6b569')
b2sums=('af608aee7c41ee4abc66ea0cb8d84c43749839440e1f43fd93d20a63aab94871e147463c0564cf811a4de8b73031e522ecbd483962a00588f4fc6b7156276dde'
'f2b9bf441c6fbdd8e341f4a26f8ae12f6dc0c9fdcc818f3c6cf017ce6fbff90742137fd223a357dc2d372a96d98b32f6c14e561dd001b1e1facbfa58261385b2')

prepare() {
# https://github.com/pyocd/cmsis-pack-manager/pull/219
patch -Np1 -d $_name -i ../$pkgname-0.5.3-update_maturin.patch

cd $_name
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
local python_build_options=(
--wheel
--no-isolation
-C"--target=$CARCH-unknown-linux-gnu"
-C"--locked"
-C"--release"
-C"--all-features"
-C"--strip"
)

cd $_name
python -m build "${python_build_options[@]}"
}

check() {
local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

cd $_name
python -m installer --destdir=test_dir dist/*.whl
export PYTHONPATH="$PWD/test_dir/$_site_packages:$PYTHONPATH"
pytest -vv
}

package() {
cd $_name
python -m installer --destdir="$pkgdir" dist/*.whl
}
13 changes: 13 additions & 0 deletions aur-repo/python-cmsis-pack-manager/lilac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
maintainers:
- github: taotieren
pre_build_script: |
update_pkgver_and_pkgrel(_G.newver)
post_build_script: |
git_pkgbuild_commit()
update_aur_repo()
update_on:
- source: github
github: pyocd/cmsis-pack-manager
use_latest_release: true
prefix: v
- alias: python
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
From 5d9fd7a54169f770d69b1931ddbbe1020a8355e2 Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Fri, 1 Dec 2023 12:44:59 +0100
Subject: [PATCH 1/3] Update maturin build requirement to >=1,<2

Signed-off-by: David Runge <dave@sleepmap.de>
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 20898079b..348237db1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[build-system]
requires = [
- "maturin>=0.13,<0.15",
+ "maturin>=1,<2",
"cffi",
]
build-backend = "maturin"

From 01d911c729adb2a0e8c73aa3ed49ace91ff68acb Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Fri, 1 Dec 2023 12:49:28 +0100
Subject: [PATCH 2/3] Add pytest configuration options to pyproject.toml

Signed-off-by: David Runge <dave@sleepmap.de>
---
pyproject.toml | 3 +++
1 file changed, 3 insertions(+)

diff --git a/pyproject.toml b/pyproject.toml
index 348237db1..d5e801067 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -60,3 +60,6 @@ Changelog = "https://github.com/pyocd/cmsis-pack-manager/releases"

[tool.maturin]
bindings = "cffi"
+
+[tool.pytest.ini_options]
+python_files = "tests/*.py"

From 74600aa37ab421bcb78ddacb690019080170b2d5 Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Fri, 1 Dec 2023 12:51:06 +0100
Subject: [PATCH 3/3] Remove unneeded setup.cfg file

All configuration is done in pyproject.toml

Signed-off-by: David Runge <dave@sleepmap.de>
---
setup.cfg | 56 -------------------------------------------------------
1 file changed, 56 deletions(-)
delete mode 100644 setup.cfg

diff --git a/setup.cfg b/setup.cfg
deleted file mode 100644
index 0b054b5cd..000000000
--- a/setup.cfg
+++ /dev/null
@@ -1,56 +0,0 @@
-[metadata]
-name = cmsis-pack-manager
-description = Python manager for CMSIS-Pack index and cache with fast Rust backend
-long_description = file: README.md
-long_description_content_type = text/markdown
-url = https://github.com/pyocd/cmsis-pack-manager
-maintainer = Mathias Brossard, Chris Reed
-maintainer_email = mathias.brossard@arm.com, flit@me.com
-license = Apache 2.0
-license_file = LICENSE
-classifiers =
- Development Status :: 4 - Beta
- Intended Audience :: Developers
- License :: OSI Approved :: Apache Software License
- Operating System :: MacOS
- Operating System :: Microsoft :: Windows
- Operating System :: POSIX
- Operating System :: Unix
- Programming Language :: Python
- Programming Language :: Python :: 3.6
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
- Programming Language :: Python :: 3.9
- Programming Language :: Python :: 3.10
- Programming Language :: Python :: 3.11
- Topic :: Software Development
- Topic :: Software Development :: Debuggers
- Topic :: Software Development :: Embedded Systems
- Topic :: Utilities
-project_urls =
- Documentation = https://github.com/pyocd/cmsis-pack-manager/
- Bug Tracker = https://github.com/pyocd/cmsis-pack-manager/issues
- Discussions = https://github.com/pyocd/cmsis-pack-manager/discussions
- Changelog = https://github.com/pyocd/cmsis-pack-manager/releases
-
-[options]
-packages = find:
-install_requires =
- appdirs>=1.4,<2.0
- pyyaml>=6.0,<7.0
-python_requires = >=3.6
-include_package_data = True
-zip_safe = False
-
-[options.extras_require]
-test =
- pytest>=6.0
- hypothesis
- jinja2
-
-[options.entry_points]
-console_scripts =
- pack-manager = cmsis_pack_manager.pack_manager:main
-
-[tool:pytest]
-python_files = tests/*.py

0 comments on commit 4e122cf

Please sign in to comment.