From 035800332b99e9be29484af5529e754f11070e3b Mon Sep 17 00:00:00 2001 From: Dominic Shelton Date: Tue, 9 Jul 2024 15:54:08 +1000 Subject: [PATCH 1/3] python3Packages.pyocd: python 3.12 fixes --- .../python-modules/pyocd/default.nix | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/pyocd/default.nix b/pkgs/development/python-modules/pyocd/default.nix index 7f7f8d2465a37..15a0a2dbdbfaf 100644 --- a/pkgs/development/python-modules/pyocd/default.nix +++ b/pkgs/development/python-modules/pyocd/default.nix @@ -17,7 +17,6 @@ pylink-square, pyusb, pyyaml, - setuptools, setuptools-scm, typing-extensions, stdenv, @@ -44,17 +43,11 @@ buildPythonPackage rec { }) ]; - postPatch = '' - substituteInPlace setup.cfg \ - --replace "libusb-package>=1.0,<2.0" "" - ''; + pythonRemoveDeps = [ "libusb-package" ]; - nativeBuildInputs = [ - setuptools - setuptools-scm - ]; + build-system = [ setuptools-scm ]; - propagatedBuildInputs = [ + dependencies = [ capstone_4 cmsis-pack-manager colorama @@ -74,6 +67,12 @@ buildPythonPackage rec { pythonImportsCheck = [ "pyocd" ]; + disabledTests = [ + # AttributeError: 'not_called' is not a valid assertion + # Upstream fix at https://github.com/pyocd/pyOCD/pull/1710 + "test_transfer_err_not_flushed" + ]; + nativeCheckInputs = [ pytestCheckHook ]; meta = with lib; { From dcce54a0a765389288d66bdc518d76984c5cd0b4 Mon Sep 17 00:00:00 2001 From: Dominic Shelton Date: Thu, 20 Jun 2024 12:42:26 +1000 Subject: [PATCH 2/3] python3Packages.libusbsio 2.1.11 -> 2.1.12 Its version is no longer in sync with libusbsio --- .../python-modules/libusbsio/default.nix | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/libusbsio/default.nix b/pkgs/development/python-modules/libusbsio/default.nix index 7e60f9ab22897..4ebd50e349ece 100644 --- a/pkgs/development/python-modules/libusbsio/default.nix +++ b/pkgs/development/python-modules/libusbsio/default.nix @@ -1,25 +1,26 @@ { lib, buildPythonPackage, + fetchPypi, libusbsio, }: buildPythonPackage rec { pname = "libusbsio"; format = "setuptools"; - inherit (libusbsio) version; + version = "2.1.12"; + # If the versions come back into sync switch back to inheriting from c lib + # inherit (libusbsio) version; - src = "${libusbsio.src}/python"; - - # The source includes both the python module directly and also a source tarball for it. - # The direct files lack setup information, the tarball includes unwanted binaries. - # This takes only the setup files from the tarball. - postUnpack = '' - tar -C python --strip-components=1 -xf python/dist/libusbsio-${version}.tar.gz libusbsio-${version}/{setup.py,setup.cfg,pyproject.toml} - rm -r python/dist - ''; + src = fetchPypi { + inherit pname version; + hash = "sha256-RdUhwilBOwg19ay3Po3zsxqlBV9FTy3btJDbO4YEKS8="; + }; + # The source includes both the python module directly and also prebuilt binaries + # Delete the binaries and patch the wrapper to use binary from Nixpkgs instead postPatch = '' + rm -rf libusbsio/bin substituteInPlace libusbsio/libusbsio.py \ --replace "dllpath = LIBUSBSIO._lookup_dll_path(dfltdir, dllname)" 'dllpath = "${libusbsio}/lib/" + dllname' ''; @@ -31,8 +32,8 @@ buildPythonPackage rec { pythonImportsCheck = [ "libusbsio" ]; meta = with lib; { - description = "NXP Secure Provisioning SDK"; - homepage = "https://github.com/NXPmicro/spsdk"; + description = "LIBUSBSIO Host Library for USB Enabled MCUs"; + homepage = "https://www.nxp.com/design/design-center/software/development-software/libusbsio-host-library-for-usb-enabled-mcus:LIBUSBSIO"; license = licenses.bsd3; maintainers = with maintainers; [ frogamic From 719a79df78c1d92b4aec6302ed9c44c313fccbac Mon Sep 17 00:00:00 2001 From: Dominic Shelton Date: Thu, 20 Jun 2024 12:41:31 +1000 Subject: [PATCH 3/3] python3Packages.spsdk 2.1.1 -> 2.2.0 Patch out pyocd_pemicro, unused and unfree dependency --- .../python-modules/spsdk/default.nix | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/pkgs/development/python-modules/spsdk/default.nix b/pkgs/development/python-modules/spsdk/default.nix index 64f8c26489414..e08224aa9e874 100644 --- a/pkgs/development/python-modules/spsdk/default.nix +++ b/pkgs/development/python-modules/spsdk/default.nix @@ -3,7 +3,6 @@ buildPythonPackage, fetchFromGitHub, asn1crypto, - astunparse, bincopy, bitstring, click, @@ -17,16 +16,14 @@ hexdump, libusbsio, oscrypto, + packaging, platformdirs, prettytable, - pylink-square, pyocd, - pyocd-pemicro, - pypemicro, pyserial, requests, ruamel-yaml, - setuptools, + setuptools-scm, sly, spsdk, testers, @@ -39,31 +36,30 @@ buildPythonPackage rec { pname = "spsdk"; - version = "2.1.1"; + version = "2.2.0"; pyproject = true; src = fetchFromGitHub { owner = "nxp-mcuxpresso"; repo = "spsdk"; rev = "refs/tags/${version}"; - hash = "sha256-cWz2zML/gb9l2C5VEBti+nX3ZLyGbLFyLZGjk5GfTJw="; + hash = "sha256-2CFxJAP87ysly0i4AfODbwUt5W287+OK7fatdPco7e4="; }; - nativeBuildInputs = [ - setuptools - ]; + build-system = [ setuptools-scm ]; pythonRelaxDeps = [ - "click" - "cryptography" - "platformdirs" "requests" + "packaging" "typing-extensions" ]; - propagatedBuildInputs = [ + # Remove unneeded unfree package. pyocd-pemicro is only used when + # generating a pyinstaller package, which we don't do. + pythonRemoveDeps = [ "pyocd-pemicro" ]; + + dependencies = [ asn1crypto - astunparse bincopy bitstring click @@ -77,12 +73,10 @@ buildPythonPackage rec { hexdump libusbsio oscrypto + packaging platformdirs prettytable - pylink-square pyocd - pyocd-pemicro - pypemicro pyserial requests ruamel-yaml @@ -97,11 +91,6 @@ buildPythonPackage rec { voluptuous ]; - disabledTests = [ - "test_nxpcrypto_create_signature_algorithm" - "test_nxpimage_sb31_kaypair_not_matching" - ]; - pythonImportsCheck = [ "spsdk" ]; passthru.tests.version = testers.testVersion { package = spsdk; };