[arch-commits] Commit in (6 files)

David Runge dvzrv at gemini.archlinux.org
Fri Feb 11 20:48:17 UTC 2022


    Date: Friday, February 11, 2022 @ 20:48:17
  Author: dvzrv
Revision: 1132230

Add python-pyocd as dependency for python-spsdk (new dependency for python-pynitrokey).

Added:
  python-pyocd/
  python-pyocd/repos/
  python-pyocd/trunk/
  python-pyocd/trunk/PKGBUILD
  python-pyocd/trunk/python-pyocd-0.33.1-optional_libusb_package.patch
  python-pyocd/trunk/python-pyocd-0.33.1-support_prettytable3.patch

---------------------------------------------------+
 PKGBUILD                                          |   81 +++++++++++
 python-pyocd-0.33.1-optional_libusb_package.patch |  138 ++++++++++++++++++++
 python-pyocd-0.33.1-support_prettytable3.patch    |   12 +
 3 files changed, 231 insertions(+)

Added: python-pyocd/trunk/PKGBUILD
===================================================================
--- python-pyocd/trunk/PKGBUILD	                        (rev 0)
+++ python-pyocd/trunk/PKGBUILD	2022-02-11 20:48:17 UTC (rev 1132230)
@@ -0,0 +1,81 @@
+# Maintainer: David Runge <dvzrv at archlinux.org>
+
+_name=pyocd
+pkgname=python-pyocd
+pkgver=0.33.1
+pkgrel=1
+pkgdesc="Programming and debugging Arm Cortex-M microcontrollers"
+arch=(any)
+url="https://github.com/pyocd/pyOCD"
+license=(Apache)
+depends=(
+  python-capstone
+  python-cmsis-pack-manager
+  python-colorama
+  python-intelhex
+  python-intervaltree
+  python-natsort
+  python-prettytable
+  python-pyelftools
+  python-pylink-square
+  python-pyusb
+  python-pyyaml
+  python-six
+  python-typing-extensions
+)
+makedepends=(python-setuptools python-setuptools-scm python-toml python-wheel)
+checkdepends=(python-pytest python-typing-extensions)
+provides=(pyocd)
+conflicts=(pyocd)
+replaces=(pyocd)
+source=(
+  "https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz"
+  $pkgname-0.33.1-optional_libusb_package.patch
+  $pkgname-0.33.1-support_prettytable3.patch
+)
+sha512sums=('52acb68a5e938509df25d79b12af4374cbc98a4beb7771d039fa9de31ebb779bf098398c311ed96ddf7f38ee1b29e5eb1cdc950ad458a86187185cef1e7d12d5'
+            'cbcf65ead4f72025c28e9d42e7947db9671c8de62a797dc27d1198dbdb164afe51b5cafb83224e5c0797b5ae6ea8a9f91080aae81f00934309645a47d0154eaf'
+            '196bd3ad3718baf881ab3ca30d7e135be180e1185ccbc0e8f854a5754d5bf53d048985f970cbe943fb02228e82c0d07e56d74ddb28b72b078bdb997464b3d35c')
+b2sums=('2dfefd23fef60bc667de095781e071afcfd93299792473a19b9f508ee856ae1dfd0ff7be075ddcddae79717424134b4b30a0ec224a174397ba3303952cfa0cc0'
+        'dfed46c4e852cf28029573acd49aef06e51a3280851111ebc40bd7110c1900f480e77ade970c9b4d5574e9966cab996014b503991fdb8879aa9113f9d8091edb'
+        '4447a64d11b4cb480762d323681c08b3f5e0d8e50f2b776faf6a53ed69eb3b492973146d837a310b272e7aac9578c7e54e641100229d8df783ee6179b30857ba')
+
+prepare() {
+  cd $_name-$pkgver
+  # support prettytable >= 3.0: https://github.com/pyocd/pyOCD/pull/1330
+  patch -Np1 -i ../$pkgname-0.33.1-support_prettytable3.patch
+
+  # python-pyocd-pemicro drags in obfuscated prebuilt shared objects via python-pypemicro:
+  # https://github.com/NXPmicro/pypemicro/issues/10
+  # https://github.com/pyocd/pyOCD/issues/1319
+  sed '/pyocd_pemicro/d' -i setup.cfg
+
+  # we remove the dependency for libusb-package, because it would vendor libusb
+  # https://github.com/pyocd/pyOCD/issues/1331
+  sed '/libusb-package/d' -i setup.cfg
+  patch -Np1 -i ../$pkgname-0.33.1-optional_libusb_package.patch
+
+  # tag devices with uaccess to automatically make them available to active user sessions
+  sed -e 's|MODE:="666"|MODE:="0660", TAG+="uaccess"|g' -i udev/*{cmsis,pico}*.rules
+  sed -e 's|MODE:="0666"|MODE:="0660", TAG+="uaccess"|g' -i udev/*stlink*.rules
+}
+
+build() {
+  cd $_name-$pkgver
+  python setup.py build
+}
+
+check() {
+  cd $_name-$pkgver
+  export PYTHONPATH="build:$PYTHONPATH"
+  # do not run tests that would require packaging python-elapsedtimer
+  # https://github.com/pyocd/pyOCD/issues/1333
+  pytest -v --ignore test/unit/test_semihosting.py
+}
+
+package() {
+  cd $_name-$pkgver
+  python setup.py install --optimize=1 --root="$pkgdir"
+  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
+  install -vDm 644 udev/*.rules -t "$pkgdir/usr/lib/udev/rules.d/"
+}

Added: python-pyocd/trunk/python-pyocd-0.33.1-optional_libusb_package.patch
===================================================================
--- python-pyocd/trunk/python-pyocd-0.33.1-optional_libusb_package.patch	                        (rev 0)
+++ python-pyocd/trunk/python-pyocd-0.33.1-optional_libusb_package.patch	2022-02-11 20:48:17 UTC (rev 1132230)
@@ -0,0 +1,138 @@
+diff --git c/pyocd/probe/picoprobe.py w/pyocd/probe/picoprobe.py
+index 481e984f..14d1214d 100644
+--- c/pyocd/probe/picoprobe.py
++++ w/pyocd/probe/picoprobe.py
+@@ -18,8 +18,12 @@
+ from array import array
+ 
+ from time import sleep
++try:
++    from libusb_package import find as usb_find
++except ImportError:
++    from usb.core import find as usb_find
++
+ from usb import core, util
+-import libusb_package
+ 
+ import platform
+ import errno
+@@ -108,7 +112,7 @@ class PicoLink(object):
+         """@brief Find and return all Picoprobes """
+         try:
+             # Use a custom matcher to make sure the probe is a Picoprobe and accessible.
+-            return [PicoLink(probe) for probe in libusb_package.find(find_all=True, custom_match=FindPicoprobe(uid))]
++            return [PicoLink(probe) for probe in usb_find(find_all=True, custom_match=FindPicoprobe(uid))]
+         except core.NoBackendError:
+             show_no_libusb_warning()
+             return []
+diff --git c/pyocd/probe/pydapaccess/interface/pyusb_backend.py w/pyocd/probe/pydapaccess/interface/pyusb_backend.py
+index cf240043..229fc7c5 100644
+--- c/pyocd/probe/pydapaccess/interface/pyusb_backend.py
++++ w/pyocd/probe/pydapaccess/interface/pyusb_backend.py
+@@ -37,7 +37,6 @@ TRACE = LOG.getChild("trace")
+ TRACE.setLevel(logging.CRITICAL)
+ 
+ try:
+-    import libusb_package
+     import usb.core
+     import usb.util
+ except ImportError:
+@@ -45,6 +44,12 @@ except ImportError:
+ else:
+     IS_AVAILABLE = True
+ 
++try:
++    from libusb_package import find as usb_find
++except ImportError:
++    from usb.core import find as usb_find
++
++
+ class PyUSB(Interface):
+     """@brief CMSIS-DAP USB interface class using pyusb for the backend."""
+ 
+@@ -70,7 +75,7 @@ class PyUSB(Interface):
+         assert self.closed is True
+ 
+         # Get device handle
+-        dev = libusb_package.find(custom_match=FindDap(self.serial_number))
++        dev = usb_find(custom_match=FindDap(self.serial_number))
+         if dev is None:
+             raise DAPAccessIntf.DeviceError("Device %s not found" % self.serial_number)
+ 
+@@ -161,7 +166,7 @@ class PyUSB(Interface):
+         """
+         # find all cmsis-dap devices
+         try:
+-            all_devices = libusb_package.find(find_all=True, custom_match=FindDap())
++            all_devices = usb_find(find_all=True, custom_match=FindDap())
+         except usb.core.NoBackendError:
+             if not PyUSB.did_show_no_libusb_warning:
+                 LOG.warning("CMSIS-DAPv1 probes may not be detected because no libusb library was found.")
+diff --git c/pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py w/pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py
+index a9b0a1a0..e2007908 100644
+--- c/pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py
++++ w/pyocd/probe/pydapaccess/interface/pyusb_v2_backend.py
+@@ -38,7 +38,6 @@ TRACE = LOG.getChild("trace")
+ TRACE.setLevel(logging.CRITICAL)
+ 
+ try:
+-    import libusb_package
+     import usb.core
+     import usb.util
+ except ImportError:
+@@ -46,6 +45,12 @@ except ImportError:
+ else:
+     IS_AVAILABLE = True
+ 
++try:
++    from libusb_package import find as usb_find
++except ImportError:
++    from usb.core import find as usb_find
++
++
+ class PyUSBv2(Interface):
+     """@brief CMSIS-DAPv2 interface using pyUSB."""
+ 
+@@ -84,7 +89,7 @@ class PyUSBv2(Interface):
+         assert self.closed is True
+ 
+         # Get device handle
+-        dev = libusb_package.find(custom_match=HasCmsisDapv2Interface(self.serial_number))
++        dev = usb_find(custom_match=HasCmsisDapv2Interface(self.serial_number))
+         if dev is None:
+             raise DAPAccessIntf.DeviceError("Device %s not found" %
+                                             self.serial_number)
+@@ -187,7 +192,7 @@ class PyUSBv2(Interface):
+         """@brief Returns all the connected devices with a CMSIS-DAPv2 interface."""
+         # find all cmsis-dap devices
+         try:
+-            all_devices = libusb_package.find(find_all=True, custom_match=HasCmsisDapv2Interface())
++            all_devices = usb_find(find_all=True, custom_match=HasCmsisDapv2Interface())
+         except usb.core.NoBackendError:
+             common.show_no_libusb_warning()
+             return []
+diff --git c/pyocd/probe/stlink/usb.py w/pyocd/probe/stlink/usb.py
+index c9a400af..883c014c 100644
+--- c/pyocd/probe/stlink/usb.py
++++ w/pyocd/probe/stlink/usb.py
+@@ -15,7 +15,10 @@
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ 
+-import libusb_package
++try:
++    from libusb_package import find as usb_find
++except ImportError:
++    from usb.core import find as usb_find
+ import usb.core
+ import usb.util
+ import logging
+@@ -101,7 +104,7 @@ class STLinkUSBInterface:
+     @classmethod
+     def get_all_connected_devices(cls):
+         try:
+-            devices = libusb_package.find(find_all=True, custom_match=cls._usb_match)
++            devices = usb_find(find_all=True, custom_match=cls._usb_match)
+         except usb.core.NoBackendError:
+             common.show_no_libusb_warning()
+             return []

Added: python-pyocd/trunk/python-pyocd-0.33.1-support_prettytable3.patch
===================================================================
--- python-pyocd/trunk/python-pyocd-0.33.1-support_prettytable3.patch	                        (rev 0)
+++ python-pyocd/trunk/python-pyocd-0.33.1-support_prettytable3.patch	2022-02-11 20:48:17 UTC (rev 1132230)
@@ -0,0 +1,12 @@
+diff -ruN a/setup.cfg b/setup.cfg
+--- a/setup.cfg	2022-02-07 20:28:32.236504600 +0100
++++ b/setup.cfg	2022-02-11 21:44:32.500456029 +0100
+@@ -55,7 +55,7 @@
+ 	intervaltree>=3.0.2,<4.0
+ 	libusb-package>=1.0,<2.0
+ 	natsort>=8.0.0,<9.0
+-	prettytable>=2.0,<3.0
++	prettytable>=2.0,<4.0
+ 	pyelftools<1.0
+ 	pylink-square>=0.11.1,<1.0
+ 	pyocd_pemicro>=1.0.6



More information about the arch-commits mailing list