2019-09-28 16:51:11 +02:00
|
|
|
{ stdenv, fetchPypi, buildPythonPackage, swig, pcsclite, PCSC }:
|
2017-01-17 02:18:27 +01:00
|
|
|
|
2019-07-20 14:05:34 +02:00
|
|
|
let
|
|
|
|
# Package does not support configuring the pcsc library.
|
|
|
|
withApplePCSC = stdenv.isDarwin;
|
|
|
|
|
|
|
|
inherit (stdenv.lib) getLib getDev optionalString optionals;
|
|
|
|
inherit (stdenv.hostPlatform.extensions) sharedLibrary;
|
|
|
|
in
|
|
|
|
|
2017-01-17 02:18:27 +01:00
|
|
|
buildPythonPackage rec {
|
2019-09-28 13:50:26 +02:00
|
|
|
version = "1.9.9";
|
2017-05-27 11:25:35 +02:00
|
|
|
pname = "pyscard";
|
2017-01-17 02:18:27 +01:00
|
|
|
|
2018-06-23 15:27:58 +02:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-09-28 13:50:26 +02:00
|
|
|
sha256 = "082cjkbxadaz2jb4rbhr0mkrirzlqyqhcf3r823qb0q1k50ybgg6";
|
2017-01-17 02:18:27 +01:00
|
|
|
};
|
|
|
|
|
2019-07-20 14:05:34 +02: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" \
|
|
|
|
"${getLib pcsclite}/lib/libpcsclite${sharedLibrary}"
|
2017-01-19 15:20:54 +01:00
|
|
|
'';
|
2017-01-17 02:18:27 +01:00
|
|
|
|
2019-07-20 14:05:34 +02:00
|
|
|
NIX_CFLAGS_COMPILE = optionalString (! withApplePCSC)
|
|
|
|
"-I ${getDev pcsclite}/include/PCSC";
|
2017-01-17 02:18:27 +01:00
|
|
|
|
2019-07-20 14:05:34 +02:00
|
|
|
propagatedBuildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
|
2019-03-01 14:38:48 +01:00
|
|
|
nativeBuildInputs = [ swig ];
|
2017-01-17 02:18:27 +01:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://pyscard.sourceforge.io/";
|
2017-01-17 02:18:27 +01:00
|
|
|
description = "Smartcard library for python";
|
|
|
|
license = stdenv.lib.licenses.lgpl21;
|
2017-01-19 15:20:54 +01:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ layus ];
|
2017-01-17 02:18:27 +01:00
|
|
|
};
|
|
|
|
}
|