1 { lib, stdenv, fetchPypi, buildPythonPackage, swig, pcsclite, PCSC }:
4 # Package does not support configuring the pcsc library.
5 withApplePCSC = stdenv.isDarwin;
8 buildPythonPackage rec {
13 inherit pname version;
14 sha256 = "0yap0p8mp6dx58n3nina6ryhc2cysaj75sq98wf3qybf33cxjr5k";
17 postPatch = if withApplePCSC then ''
18 substituteInPlace smartcard/scard/winscarddll.c \
19 --replace "/System/Library/Frameworks/PCSC.framework/PCSC" \
20 "${PCSC}/Library/Frameworks/PCSC.framework/PCSC"
22 substituteInPlace smartcard/scard/winscarddll.c \
23 --replace "libpcsclite.so.1" \
24 "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}"
27 NIX_CFLAGS_COMPILE = lib.optionalString (! withApplePCSC)
28 "-I ${lib.getDev pcsclite}/include/PCSC";
30 propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
31 nativeBuildInputs = [ swig ];
34 homepage = "https://pyscard.sourceforge.io/";
35 description = "Smartcard library for python";
36 license = licenses.lgpl21;
37 maintainers = with maintainers; [ layus ];