about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyscard
diff options
context:
space:
mode:
authorKevin Griffin <me@kevin.jp>2020-06-28 19:57:30 +0900
committerJon <jonringer@users.noreply.github.com>2020-07-06 20:07:53 -0700
commit44fd570d7344fb31d7dd92a42d6e1ef872b5f76b (patch)
tree2886e4d20bfda2c512d4c3b49d98727264b31d67 /pkgs/development/python-modules/pyscard
parent51a36a40755286a35ccec612064f8f747ac6c4fb (diff)
pythonPackages.pyscard: Fix build on Darwin
The previously provided patch is still necessary,
as nix python reports an old version of macOS
that has the bug, when in fact modern macOS
does not have the misspelling.

The patch has been upstreamed, so we take it
to fix 1.9.9 in anticipation of the next release.
Diffstat (limited to 'pkgs/development/python-modules/pyscard')
-rw-r--r--pkgs/development/python-modules/pyscard/default.nix17
-rw-r--r--pkgs/development/python-modules/pyscard/ignore-macos-bug.patch22
2 files changed, 16 insertions, 23 deletions
diff --git a/pkgs/development/python-modules/pyscard/default.nix b/pkgs/development/python-modules/pyscard/default.nix
index 4bda0b3c65c0f..d563a62a46b3a 100644
--- a/pkgs/development/python-modules/pyscard/default.nix
+++ b/pkgs/development/python-modules/pyscard/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchPypi, buildPythonPackage, swig, pcsclite, PCSC }:
+{ stdenv, fetchPypi, fetchpatch, buildPythonPackage, swig, pcsclite, PCSC }:
 
 let
   # Package does not support configuring the pcsc library.
@@ -30,6 +30,21 @@ buildPythonPackage rec {
   NIX_CFLAGS_COMPILE = optionalString (! withApplePCSC)
     "-I ${getDev pcsclite}/include/PCSC";
 
+  # The error message differs depending on the macOS host version.
+  # Since Nix reports a constant host version, but proxies to the
+  # underlying library, it's not possible to determine the correct
+  # expected error message.  This patch allows both errors to be
+  # accepted.
+  # See: https://github.com/LudovicRousseau/pyscard/issues/77
+  # Building with python from nix on macOS version 10.13 or
+  # greater still causes this issue to occur.
+  patches = optionals withApplePCSC [
+    (fetchpatch {
+      url = "https://github.com/LudovicRousseau/pyscard/commit/945e9c4cd4036155691f6ce9706a84283206f2ef.patch";
+      sha256 = "19n8w1wzn85zywr6xf04d8nfg7sgzjyvxp1ccp3rgfr4mcc36plc";
+    })
+  ];
+
   propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
   nativeBuildInputs = [ swig ];
 
diff --git a/pkgs/development/python-modules/pyscard/ignore-macos-bug.patch b/pkgs/development/python-modules/pyscard/ignore-macos-bug.patch
deleted file mode 100644
index 62b20477c9f8b..0000000000000
--- a/pkgs/development/python-modules/pyscard/ignore-macos-bug.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/test/test_SCardGetErrorMessage.py b/test/test_SCardGetErrorMessage.py
-old mode 100644
-new mode 100755
-index c6fe755..c1217f5
---- a/test/test_SCardGetErrorMessage.py
-+++ b/test/test_SCardGetErrorMessage.py
-@@ -29,12 +29,10 @@ class TestError(unittest.TestCase):
-         self.assertEqual(res, expected)
- 
-         res = SCardGetErrorMessage(1)
-+        expected = "Unknown error: 0x00000001"
-         # macOS bug not yet fixed
--        if get_platform().startswith('macosx-') and get_platform() < 'macosx-10.13':
--            expected = "Unkown error: 0x00000001"
--        else:
--            expected = "Unknown error: 0x00000001"
--        self.assertEqual(res, expected)
-+        macos_bug_expected = "Unkown error: 0x00000001"
-+        self.assertIn(res, [expected, macos_bug_expected])
- 
- 
- if __name__ == '__main__':