Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 1.6 kB view raw
1{ lib, stdenv, fetchpatch, 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.2"; 10 pname = "pyscard"; 11 12 src = fetchPypi { 13 inherit pname version; 14 sha256 = "05de0579c42b4eb433903aa2fb327d4821ebac262434b6584da18ed72053fd9e"; 15 }; 16 17 patches = [ 18 # present in master - remove after 2.0.2 19 (fetchpatch { 20 name = "darwin-typo-test-fix.patch"; 21 url = "https://github.com/LudovicRousseau/pyscard/commit/ce842fcc76fd61b8b6948d0b07306d82ad1ec12a.patch"; 22 sha256 = "0wsaj87wp9d2vnfzwncfxp2w95m0zhr7zpkmg5jccn06z52ihis3"; 23 }) 24 ]; 25 26 postPatch = if withApplePCSC then '' 27 substituteInPlace smartcard/scard/winscarddll.c \ 28 --replace "/System/Library/Frameworks/PCSC.framework/PCSC" \ 29 "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" 30 '' else '' 31 substituteInPlace smartcard/scard/winscarddll.c \ 32 --replace "libpcsclite.so.1" \ 33 "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" 34 ''; 35 36 env.NIX_CFLAGS_COMPILE = lib.optionalString (! withApplePCSC) 37 "-I ${lib.getDev pcsclite}/include/PCSC"; 38 39 propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ]; 40 nativeBuildInputs = [ swig ]; 41 42 meta = with lib; { 43 homepage = "https://pyscard.sourceforge.io/"; 44 description = "Smartcard library for python"; 45 license = licenses.lgpl21; 46 maintainers = with maintainers; [ layus ]; 47 }; 48}