2021-01-24 00:29:22 +00:00
|
|
|
{ lib, stdenv, fetchPypi, buildPythonPackage, swig, pcsclite, PCSC }:
|
2017-01-17 01:18:27 +00:00
|
|
|
|
2019-07-20 12:05:34 +00:00
|
|
|
let
|
|
|
|
# Package does not support configuring the pcsc library.
|
|
|
|
withApplePCSC = stdenv.isDarwin;
|
|
|
|
in
|
|
|
|
|
2017-01-17 01:18:27 +00:00
|
|
|
buildPythonPackage rec {
|
2020-11-08 10:41:06 +00:00
|
|
|
version = "2.0.0";
|
2017-05-27 09:25:35 +00:00
|
|
|
pname = "pyscard";
|
2017-01-17 01:18:27 +00:00
|
|
|
|
2018-06-23 13:27:58 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-11-08 10:41:06 +00:00
|
|
|
sha256 = "0yap0p8mp6dx58n3nina6ryhc2cysaj75sq98wf3qybf33cxjr5k";
|
2017-01-17 01:18:27 +00:00
|
|
|
};
|
|
|
|
|
2019-07-20 12:05:34 +00:00
|
|
|
postPatch = if withApplePCSC then ''
|
|
|
|
substituteInPlace smartcard/scard/winscarddll.c \
|
|
|
|
--replace "/System/Library/Frameworks/PCSC.framework/PCSC" \
|
|
|
|
"${PCSC}/Library/Frameworks/PCSC.framework/PCSC"
|
|
|
|
'' else ''
|
|
|
|
substituteInPlace smartcard/scard/winscarddll.c \
|
|
|
|
--replace "libpcsclite.so.1" \
|
2021-01-24 00:29:22 +00:00
|
|
|
"${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}"
|
2017-01-19 14:20:54 +00:00
|
|
|
'';
|
2017-01-17 01:18:27 +00:00
|
|
|
|
2021-01-24 00:29:22 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString (! withApplePCSC)
|
|
|
|
"-I ${lib.getDev pcsclite}/include/PCSC";
|
2017-01-17 01:18:27 +00:00
|
|
|
|
2019-07-20 12:05:34 +00:00
|
|
|
propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
|
2019-03-01 13:38:48 +00:00
|
|
|
nativeBuildInputs = [ swig ];
|
2017-01-17 01:18:27 +00:00
|
|
|
|
2021-01-24 00:29:22 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://pyscard.sourceforge.io/";
|
2017-01-17 01:18:27 +00:00
|
|
|
description = "Smartcard library for python";
|
2021-01-24 00:29:22 +00:00
|
|
|
license = licenses.lgpl21;
|
|
|
|
maintainers = with maintainers; [ layus ];
|
2017-01-17 01:18:27 +00:00
|
|
|
};
|
|
|
|
}
|