at master 1.4 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pcsclite, 6 pkg-config, 7 pytestCheckHook, 8 setuptools, 9 stdenv, 10 swig, 11}: 12 13buildPythonPackage rec { 14 pname = "pyscard"; 15 version = "2.3.0"; 16 pyproject = true; 17 18 src = fetchFromGitHub { 19 owner = "LudovicRousseau"; 20 repo = "pyscard"; 21 tag = version; 22 hash = "sha256-rz3m8eVbmJUMcQFuEMZwF3k/ES75KcNA8R+xix+Mgq8="; 23 }; 24 25 build-system = [ setuptools ]; 26 27 nativeBuildInputs = [ swig ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pkg-config ]; 28 29 buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ pcsclite ]; 30 31 nativeCheckInputs = [ pytestCheckHook ]; 32 33 postPatch = '' 34 substituteInPlace pyproject.toml \ 35 --replace-fail 'requires = ["setuptools","swig"]' 'requires = ["setuptools"]' 36 '' 37 + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 38 substituteInPlace setup.py --replace-fail "pkg-config" "$PKG_CONFIG" 39 substituteInPlace src/smartcard/scard/winscarddll.c \ 40 --replace-fail "libpcsclite.so.1" \ 41 "${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}" 42 ''; 43 44 meta = { 45 description = "Smartcard library for python"; 46 homepage = "https://pyscard.sourceforge.io/"; 47 changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${src.tag}"; 48 license = lib.licenses.lgpl21Plus; 49 maintainers = with lib.maintainers; [ layus ]; 50 }; 51}