Merge pull request #267528 from NickCao/pyscard

python311Packages.pyscard: modernize, stop propagating PCSC/pcsclite …

authored by Guillaume Maudoux and committed by GitHub a2dbeea7 c703e263

+37 -17
+37 -17
pkgs/development/python-modules/pyscard/default.nix
··· 1 { lib 2 , stdenv 3 - , fetchPypi 4 , buildPythonPackage 5 , swig 6 , pcsclite 7 , PCSC 8 }: 9 10 let ··· 15 buildPythonPackage rec { 16 version = "2.0.7"; 17 pname = "pyscard"; 18 19 - src = fetchPypi { 20 - inherit pname version; 21 - hash = "sha256-J4BUUl+nX76LEEYNh+3NA6cK2U1oixE0Xkc5mH+Fwb8="; 22 }; 23 24 - postPatch = if withApplePCSC then '' 25 - substituteInPlace smartcard/scard/winscarddll.c \ 26 - --replace "/System/Library/Frameworks/PCSC.framework/PCSC" \ 27 - "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" 28 - '' else '' 29 - substituteInPlace smartcard/scard/winscarddll.c \ 30 - --replace "libpcsclite.so.1" \ 31 - "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" 32 - ''; 33 34 - env.NIX_CFLAGS_COMPILE = lib.optionalString (! withApplePCSC) 35 - "-I ${lib.getDev pcsclite}/include/PCSC"; 36 37 - propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ]; 38 - nativeBuildInputs = [ swig ]; 39 40 meta = with lib; { 41 homepage = "https://pyscard.sourceforge.io/";
··· 1 { lib 2 , stdenv 3 + , fetchFromGitHub 4 , buildPythonPackage 5 + , setuptools 6 + , pkg-config 7 , swig 8 , pcsclite 9 , PCSC 10 + , pytestCheckHook 11 }: 12 13 let ··· 18 buildPythonPackage rec { 19 version = "2.0.7"; 20 pname = "pyscard"; 21 + pyproject = true; 22 23 + src = fetchFromGitHub { 24 + owner = "LudovicRousseau"; 25 + repo = "pyscard"; 26 + rev = "refs/tags/${version}"; 27 + hash = "sha256-nkDI1OPQ4SsNhWkg53ZTsG7j0+mvpkJI7dsyaOl1a/8="; 28 }; 29 30 + nativeBuildInputs = [ 31 + setuptools 32 + swig 33 + ] ++ lib.optionals (!withApplePCSC) [ 34 + pkg-config 35 + ]; 36 37 + buildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ]; 38 + 39 + nativeCheckInputs = [ 40 + pytestCheckHook 41 + ]; 42 + 43 + postPatch = 44 + if withApplePCSC then '' 45 + substituteInPlace smartcard/scard/winscarddll.c \ 46 + --replace "/System/Library/Frameworks/PCSC.framework/PCSC" \ 47 + "${PCSC}/Library/Frameworks/PCSC.framework/PCSC" 48 + '' else '' 49 + substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG" 50 + substituteInPlace smartcard/scard/winscarddll.c \ 51 + --replace "libpcsclite.so.1" \ 52 + "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" 53 + ''; 54 55 + preCheck = '' 56 + # remove src module, so tests use the installed module instead 57 + rm -r smartcard 58 + ''; 59 60 meta = with lib; { 61 homepage = "https://pyscard.sourceforge.io/";