Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.05 39 lines 1.2 kB view raw
1{ lib, stdenv, fetchPypi, buildPythonPackage, swig, pcsclite, PCSC }: 2 3let 4 # Package does not support configuring the pcsc library. 5 withApplePCSC = stdenv.isDarwin; 6in 7 8buildPythonPackage rec { 9 version = "2.0.0"; 10 pname = "pyscard"; 11 12 src = fetchPypi { 13 inherit pname version; 14 sha256 = "0yap0p8mp6dx58n3nina6ryhc2cysaj75sq98wf3qybf33cxjr5k"; 15 }; 16 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" 21 '' else '' 22 substituteInPlace smartcard/scard/winscarddll.c \ 23 --replace "libpcsclite.so.1" \ 24 "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" 25 ''; 26 27 NIX_CFLAGS_COMPILE = lib.optionalString (! withApplePCSC) 28 "-I ${lib.getDev pcsclite}/include/PCSC"; 29 30 propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ]; 31 nativeBuildInputs = [ swig ]; 32 33 meta = with lib; { 34 homepage = "https://pyscard.sourceforge.io/"; 35 description = "Smartcard library for python"; 36 license = licenses.lgpl21; 37 maintainers = with maintainers; [ layus ]; 38 }; 39}