Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save radfish/87a4a8b12817b29898d8ea87a7088d3f to your computer and use it in GitHub Desktop.
Save radfish/87a4a8b12817b29898d8ea87a7088d3f to your computer and use it in GitHub Desktop.
python-trezor-agent-git PKGBUILD patch to remove dep on backported package
From fd05c0b32b14668d6b5599e9eede27529b5311a6 Mon Sep 17 00:00:00 2001
From: redfish <redfish@galactica.pw>
Date: Mon, 24 Jun 2024 02:41:51 -0400
Subject: [PATCH] patch to remove backported shutils
That backport is needed only for Python 2. The AUR package
python-backports.shutil_which should be deleted, too.
---
.SRCINFO | 9 ++++--
...tup-remove-dep-on-backport-of-shutil.patch | 30 +++++++++++++++++++
PKGBUILD | 20 +++++++++----
3 files changed, 51 insertions(+), 8 deletions(-)
create mode 100644 0001-setup-remove-dep-on-backport-of-shutil.patch
diff --git a/.SRCINFO b/.SRCINFO
index dcfecd7..aa3b47d 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,14 @@
pkgbase = python-trezor-agent-git
pkgdesc = Hardware-based SSH/PGP agent (Trezor only)
- pkgver = v0.14.7.r6.gba8a1ba
+ pkgver = v0.14.8
pkgrel = 1
url = https://github.com/romanz/trezor-agent
arch = any
license = LGPL3
makedepends = git
makedepends = python-setuptools
+ depends = libusb
depends = python
- depends = python-backports.shutil_which
depends = python-bech32
depends = python-configargparse
depends = python-construct-classes
@@ -22,12 +22,15 @@ pkgbase = python-trezor-agent-git
depends = python-pynacl
depends = python-semver
depends = python-simple-rlp
- depends = python-trezor
+ depends = python-trezor>=0.13
depends = python-unidecode
depends = python-wheel
+ depends = trezor-udev
provides = python-trezor-agent
conflicts = python-trezor-agent
source = python-trezor-agent-git::git+https://github.com/romanz/trezor-agent.git#branch=master
+ source = 0001-setup-remove-dep-on-backport-of-shutil.patch
b2sums = SKIP
+ b2sums = 0f3921ddca9c72c9b17c72f59731677c979c2665d4e357cf80ce428bd0969720ea1bd55c923e4e3dd36af96e070e7ea137427065c2fc3b9b4c1e816079f2d725
pkgname = python-trezor-agent-git
diff --git a/0001-setup-remove-dep-on-backport-of-shutil.patch b/0001-setup-remove-dep-on-backport-of-shutil.patch
new file mode 100644
index 0000000..f6fcd71
--- /dev/null
+++ b/0001-setup-remove-dep-on-backport-of-shutil.patch
@@ -0,0 +1,30 @@
+From 7dfc7020b3f0ab119cfad7176b22899ccf3b5e06 Mon Sep 17 00:00:00 2001
+From: redfish <redfish@galactica.pw>
+Date: Mon, 24 Jun 2024 02:16:21 -0400
+Subject: [PATCH] setup: remove dep on backport of shutil
+
+This backport was needed only for Python 2 (the shutil.which module was
+backported from Python 3 to 2). In Python 3, the module is imported from
+the built-in standard library.
+
+This resolves issues with packaging for distributions, since that
+backported package doesn't exist.
+---
+ setup.py | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index aefdcdc..2dcc55a 100755
+--- a/setup.py
++++ b/setup.py
+@@ -22,7 +22,6 @@ setup(
+ 'docutils>=0.14',
+ 'python-daemon>=2.3.0',
+ 'wheel>=0.32.3',
+- 'backports.shutil_which>=3.5.1',
+ 'ConfigArgParse>=0.12.1',
+ 'python-daemon>=2.1.2',
+ 'ecdsa>=0.13',
+--
+2.45.2
+
diff --git a/PKGBUILD b/PKGBUILD
index 3090525..d730926 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
_name=trezor-agent
pkgname=python-trezor-agent-git
-pkgver=v0.14.7.r6.gba8a1ba
+pkgver=v0.14.8
pkgrel=1
pkgdesc="Hardware-based SSH/PGP agent (Trezor only)"
arch=('any')
@@ -14,8 +14,8 @@ conflicts=('python-trezor-agent')
# dependencies are for Trezor devices only (other device agents will require their own, some of which are not in the AUR) - please refer to setup.py of each agent for more information
depends=(
+ 'libusb'
'python'
- 'python-backports.shutil_which'
'python-bech32'
'python-configargparse'
'python-construct-classes'
@@ -29,21 +29,31 @@ depends=(
'python-pynacl'
'python-semver'
'python-simple-rlp'
- 'python-trezor'
+ 'python-trezor>=0.13'
'python-unidecode'
'python-wheel'
+ 'trezor-udev'
)
makedepends=('git' 'python-setuptools')
-source=("$pkgname::git+https://github.com/romanz/$_name.git#branch=master")
+source=("$pkgname::git+https://github.com/romanz/$_name.git#branch=master"
+ "0001-setup-remove-dep-on-backport-of-shutil.patch")
-b2sums=('SKIP')
+b2sums=('SKIP'
+ '0f3921ddca9c72c9b17c72f59731677c979c2665d4e357cf80ce428bd0969720ea1bd55c923e4e3dd36af96e070e7ea137427065c2fc3b9b4c1e816079f2d725')
pkgver() {
cd "$pkgname"
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
+prepare() {
+ cd "$srcdir/$pkgname"
+
+ # TODO: remove once upstream PR481 is merged
+ patch -p1 < "$srcdir/0001-setup-remove-dep-on-backport-of-shutil.patch"
+}
+
build() {
cd "$srcdir/$pkgname"
python setup.py build
--
2.45.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment