Date: Saturday, April 8, 2023 @ 05:54:30
  Author: felixonmars
Revision: 1441864

archrelease: copy trunk to community-staging-any

Added:
  python-pyocd/repos/community-staging-any/
  python-pyocd/repos/community-staging-any/PKGBUILD
    (from rev 1441861, python-pyocd/trunk/PKGBUILD)
  
python-pyocd/repos/community-staging-any/python-pyocd-0.33.1-optional_libusb_package.patch
    (from rev 1441861, 
python-pyocd/trunk/python-pyocd-0.33.1-optional_libusb_package.patch)

---------------------------------------------------+
 PKGBUILD                                          |   76 +++++++++++
 python-pyocd-0.33.1-optional_libusb_package.patch |  138 ++++++++++++++++++++
 2 files changed, 214 insertions(+)

Copied: python-pyocd/repos/community-staging-any/PKGBUILD (from rev 1441861, 
python-pyocd/trunk/PKGBUILD)
===================================================================
--- community-staging-any/PKGBUILD                              (rev 0)
+++ community-staging-any/PKGBUILD      2023-04-08 05:54:30 UTC (rev 1441864)
@@ -0,0 +1,76 @@
+# Maintainer: David Runge <[email protected]>
+
+_name=pyocd
+pkgname=python-pyocd
+pkgver=0.34.3
+pkgrel=3
+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-build python-installer python-setuptools 
python-setuptools-scm python-toml python-wheel)
+checkdepends=(python-pytest python-typing-extensions)
+optdepends=('python-setuptools: for plugin support')
+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
+)
+sha512sums=('f1ba67bc4ebdd3c3fefab462d647b65cc4f026f76752de6cd6c1042fe1857d29f4fd8cb348b9b98faf670b8e4d9d3a0a3750b0dcbbec532fd246c342f2af9308'
+            
'cbcf65ead4f72025c28e9d42e7947db9671c8de62a797dc27d1198dbdb164afe51b5cafb83224e5c0797b5ae6ea8a9f91080aae81f00934309645a47d0154eaf')
+b2sums=('4a9563b10fa00c91f3cea4829154dc7f5f495a58fc50d8e4179c0ec4351454a23a4430cff95a18c476ea4dbf71ee8ab13ef5b0be616015d5ec300ee19d2348d8'
+        
'dfed46c4e852cf28029573acd49aef06e51a3280851111ebc40bd7110c1900f480e77ade970c9b4d5574e9966cab996014b503991fdb8879aa9113f9d8091edb')
+
+prepare() {
+  cd $_name-$pkgver
+
+  # 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
+  # do not use version upper boundaries or dependencies for other OSes: 
https://bugs.archlinux.org/task/76848
+  sed -e 's/,<.*//g;/hidapi/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 -m build --wheel --no-isolation
+}
+
+check() {
+  local _site_packages=$(python -c "import site; 
print(site.getsitepackages()[0])")
+
+  cd $_name-$pkgver
+  # install to temporary location
+  python -m installer --destdir=test_dir dist/*.whl
+  export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
+  pytest -vv
+}
+
+package() {
+  cd $_name-$pkgver
+  python -m installer --destdir="$pkgdir" dist/*.whl
+  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
+  install -vDm 644 udev/*.rules -t "$pkgdir/usr/lib/udev/rules.d/"
+}

Copied: 
python-pyocd/repos/community-staging-any/python-pyocd-0.33.1-optional_libusb_package.patch
 (from rev 1441861, 
python-pyocd/trunk/python-pyocd-0.33.1-optional_libusb_package.patch)
===================================================================
--- community-staging-any/python-pyocd-0.33.1-optional_libusb_package.patch     
                        (rev 0)
+++ community-staging-any/python-pyocd-0.33.1-optional_libusb_package.patch     
2023-04-08 05:54:30 UTC (rev 1441864)
@@ -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 []

Reply via email to