From 1b6fb284994d3e6b9d55240893918b056cd874f8 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 4 May 2024 10:35:58 +0200 Subject: [PATCH 1/5] python312Packages.pyscard: disable failing tests --- pkgs/development/python-modules/pyscard/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix index 5fa9e60ae5c6..4467371717cf 100644 --- a/pkgs/development/python-modules/pyscard/default.nix +++ b/pkgs/development/python-modules/pyscard/default.nix @@ -57,9 +57,15 @@ buildPythonPackage rec { rm -r smartcard ''; + disabledTests = [ + # AssertionError + "test_hresult" + "test_low_level" + ]; + meta = with lib; { - homepage = "https://pyscard.sourceforge.io/"; description = "Smartcard library for python"; + homepage = "https://pyscard.sourceforge.io/"; license = licenses.lgpl21; maintainers = with maintainers; [ layus ]; }; From ebf0044b8f7dabfecc7b32b033785e7fa9ee4d86 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 4 May 2024 10:37:52 +0200 Subject: [PATCH 2/5] python312Packages.pyscard: refactor --- .../development/python-modules/pyscard/default.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix index 4467371717cf..e682a6286e66 100644 --- a/pkgs/development/python-modules/pyscard/default.nix +++ b/pkgs/development/python-modules/pyscard/default.nix @@ -16,8 +16,8 @@ let in buildPythonPackage rec { - version = "2.0.9"; pname = "pyscard"; + version = "2.0.9"; pyproject = true; src = fetchFromGitHub { @@ -27,8 +27,11 @@ buildPythonPackage rec { hash = "sha256-DO4Ea+mlrWPpOLI8Eki+03UnsOXEhN2PAl0+gdN5sTo="; }; - nativeBuildInputs = [ + build-system = [ setuptools + ]; + + nativeBuildInputs = [ swig ] ++ lib.optionals (!withApplePCSC) [ pkg-config @@ -43,12 +46,12 @@ buildPythonPackage rec { postPatch = if withApplePCSC then '' substituteInPlace smartcard/scard/winscarddll.c \ - --replace "/System/Library/Frameworks/PCSC.framework/PCSC" \ + --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \ "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" '' else '' substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" substituteInPlace smartcard/scard/winscarddll.c \ - --replace "libpcsclite.so.1" \ + --replace-fail "libpcsclite.so.1" \ "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" ''; @@ -66,7 +69,8 @@ buildPythonPackage rec { meta = with lib; { description = "Smartcard library for python"; homepage = "https://pyscard.sourceforge.io/"; - license = licenses.lgpl21; + changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${version}"; + license = licenses.lgpl21Plus; maintainers = with maintainers; [ layus ]; }; } From 2fec59fee99d248ec874f3e7e8b542d7169f4bfc Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 4 May 2024 10:39:20 +0200 Subject: [PATCH 3/5] python312Packages.pyscard: format with nixfmt --- .../python-modules/pyscard/default.nix | 58 +++++++++---------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix index e682a6286e66..3fd9d3c2fbd4 100644 --- a/pkgs/development/python-modules/pyscard/default.nix +++ b/pkgs/development/python-modules/pyscard/default.nix @@ -1,13 +1,14 @@ -{ lib -, stdenv -, fetchFromGitHub -, buildPythonPackage -, setuptools -, pkg-config -, swig -, pcsclite -, PCSC -, pytestCheckHook +{ + lib, + buildPythonPackage, + fetchFromGitHub, + PCSC, + pcsclite, + pkg-config, + pytestCheckHook, + setuptools, + stdenv, + swig, }: let @@ -27,33 +28,28 @@ buildPythonPackage rec { hash = "sha256-DO4Ea+mlrWPpOLI8Eki+03UnsOXEhN2PAl0+gdN5sTo="; }; - build-system = [ - setuptools - ]; + build-system = [ setuptools ]; - nativeBuildInputs = [ - swig - ] ++ lib.optionals (!withApplePCSC) [ - pkg-config - ]; + nativeBuildInputs = [ swig ] ++ lib.optionals (!withApplePCSC) [ pkg-config ]; buildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ]; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; postPatch = - if withApplePCSC then '' - substituteInPlace smartcard/scard/winscarddll.c \ - --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \ - "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" - '' else '' - substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" - substituteInPlace smartcard/scard/winscarddll.c \ - --replace-fail "libpcsclite.so.1" \ - "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" - ''; + if withApplePCSC then + '' + substituteInPlace smartcard/scard/winscarddll.c \ + --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \ + "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" + '' + else + '' + substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" + substituteInPlace smartcard/scard/winscarddll.c \ + --replace-fail "libpcsclite.so.1" \ + "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" + ''; preCheck = '' # remove src module, so tests use the installed module instead From 46a58ebd681e72ae4f67a7f7098b5065ac810196 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 4 May 2024 10:43:29 +0200 Subject: [PATCH 4/5] python312Packages.emv: refactor --- .../python-modules/emv/default.nix | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/pkgs/development/python-modules/emv/default.nix b/pkgs/development/python-modules/emv/default.nix index c7be7ba9e7fa..f5d39ffe3330 100644 --- a/pkgs/development/python-modules/emv/default.nix +++ b/pkgs/development/python-modules/emv/default.nix @@ -6,24 +6,39 @@ , pycountry , terminaltables , pytestCheckHook +, setuptools , pythonOlder }: buildPythonPackage rec { pname = "emv"; version = "1.0.14"; - format = "setuptools"; + pyproject = true; - disabled = pythonOlder "3.4"; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "russss"; repo = "python-emv"; - rev = "v${version}"; + rev = "refs/tags/v${version}"; hash = "sha256-MnaeQZ0rA3i0CoUA6HgJQpwk5yo4rm9e+pc5XzRd1eg="; }; - propagatedBuildInputs = [ + postPatch = '' + substituteInPlace setup.py \ + --replace-fail '"enum-compat==0.0.3",' "" \ + --replace-fail '"argparse==1.4.0",' "" \ + --replace-fail "click==7.1.2" "click" \ + --replace-fail "pyscard==2.0.0" "pyscard" \ + --replace-fail "pycountry==20.7.3" "pycountry" \ + --replace-fail "terminaltables==3.1.0" "terminaltables" + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ click pyscard pycountry @@ -34,25 +49,16 @@ buildPythonPackage rec { pytestCheckHook ]; - postPatch = '' - substituteInPlace setup.py \ - --replace '"enum-compat==0.0.3",' "" \ - --replace '"argparse==1.4.0",' "" \ - --replace "click==7.1.2" "click" \ - --replace "pyscard==2.0.0" "pyscard" \ - --replace "pycountry==20.7.3" "pycountry" \ - --replace "terminaltables==3.1.0" "terminaltables" - ''; - pythonImportsCheck = [ "emv" ]; meta = with lib; { description = "Implementation of the EMV chip-and-pin smartcard protocol"; - mainProgram = "emvtool"; homepage = "https://github.com/russss/python-emv"; + changelog = "https://github.com/russss/python-emv/releases/tag/v${version}"; license = licenses.mit; maintainers = with maintainers; [ lukegb ]; + mainProgram = "emvtool"; }; } From 6be65abaa9eda676aafc175c850bdc8f497875d1 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 4 May 2024 10:43:50 +0200 Subject: [PATCH 5/5] python312Packages.emv: format with nixfmt --- .../python-modules/emv/default.nix | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/pkgs/development/python-modules/emv/default.nix b/pkgs/development/python-modules/emv/default.nix index f5d39ffe3330..69d3a9ef910e 100644 --- a/pkgs/development/python-modules/emv/default.nix +++ b/pkgs/development/python-modules/emv/default.nix @@ -1,13 +1,14 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, click -, pyscard -, pycountry -, terminaltables -, pytestCheckHook -, setuptools -, pythonOlder +{ + lib, + buildPythonPackage, + fetchFromGitHub, + click, + pyscard, + pycountry, + terminaltables, + pytestCheckHook, + setuptools, + pythonOlder, }: buildPythonPackage rec { @@ -34,9 +35,7 @@ buildPythonPackage rec { --replace-fail "terminaltables==3.1.0" "terminaltables" ''; - build-system = [ - setuptools - ]; + build-system = [ setuptools ]; dependencies = [ click @@ -45,13 +44,9 @@ buildPythonPackage rec { terminaltables ]; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; - pythonImportsCheck = [ - "emv" - ]; + pythonImportsCheck = [ "emv" ]; meta = with lib; { description = "Implementation of the EMV chip-and-pin smartcard protocol";