about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyscard/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/pyscard/default.nix')
-rw-r--r--pkgs/development/python-modules/pyscard/default.nix55
1 files changed, 25 insertions, 30 deletions
diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix
index 3fd9d3c2fbd4..a5b4d28b4a7d 100644
--- a/pkgs/development/python-modules/pyscard/default.nix
+++ b/pkgs/development/python-modules/pyscard/default.nix
@@ -13,19 +13,19 @@
 
 let
   # Package does not support configuring the pcsc library.
-  withApplePCSC = stdenv.isDarwin;
+  withApplePCSC = stdenv.hostPlatform.isDarwin;
 in
 
 buildPythonPackage rec {
   pname = "pyscard";
-  version = "2.0.9";
+  version = "2.2.0";
   pyproject = true;
 
   src = fetchFromGitHub {
     owner = "LudovicRousseau";
     repo = "pyscard";
     rev = "refs/tags/${version}";
-    hash = "sha256-DO4Ea+mlrWPpOLI8Eki+03UnsOXEhN2PAl0+gdN5sTo=";
+    hash = "sha256-yZeP4Tcxnwb2My+XOsMtj+H8mNIf6JYf5tpOVUYjev0=";
   };
 
   build-system = [ setuptools ];
@@ -37,36 +37,31 @@ buildPythonPackage rec {
   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}"
-      '';
+    ''
+      substituteInPlace pyproject.toml \
+        --replace-fail 'requires = ["setuptools","swig"]' 'requires = ["setuptools"]'
+    ''
+    + (
+      if withApplePCSC then
+        ''
+          substituteInPlace src/smartcard/scard/winscarddll.c \
+            --replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \
+                      "${PCSC}/Library/Frameworks/PCSC.framework/PCSC"
+        ''
+      else
+        ''
+          substituteInPlace setup.py --replace-fail "pkg-config" "$PKG_CONFIG"
+          substituteInPlace src/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
-    rm -r smartcard
-  '';
-
-  disabledTests = [
-    # AssertionError
-    "test_hresult"
-    "test_low_level"
-  ];
-
-  meta = with lib; {
+  meta = {
     description = "Smartcard library for python";
     homepage = "https://pyscard.sourceforge.io/";
     changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${version}";
-    license = licenses.lgpl21Plus;
-    maintainers = with maintainers; [ layus ];
+    license = lib.licenses.lgpl21Plus;
+    maintainers = with lib.maintainers; [ layus ];
   };
 }