blob: 4582cc18520362760a199e384889bb295ca6ec5c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
PCSC,
pcsclite,
pkg-config,
pytestCheckHook,
setuptools,
stdenv,
swig,
}:
let
# Package does not support configuring the pcsc library.
withApplePCSC = stdenv.hostPlatform.isDarwin;
in
buildPythonPackage rec {
pname = "pyscard";
version = "2.0.9";
pyproject = true;
src = fetchFromGitHub {
owner = "LudovicRousseau";
repo = "pyscard";
rev = "refs/tags/${version}";
hash = "sha256-DO4Ea+mlrWPpOLI8Eki+03UnsOXEhN2PAl0+gdN5sTo=";
};
build-system = [ setuptools ];
nativeBuildInputs = [ swig ] ++ lib.optionals (!withApplePCSC) [ pkg-config ];
buildInputs = if withApplePCSC then [ PCSC ] else [ pcsclite ];
nativeCheckInputs = [ pytestCheckHook ];
postPatch =
if withApplePCSC then
''
substituteInPlace smartcard/scard/winscarddll.c \
--replace-fail "/System/Library/Frameworks/PCSC.framework/PCSC" \
"${PCSC}/Library/Frameworks/PCSC.framework/PCSC"
''
else
''
substituteInPlace setup.py --replace "pkg-config" "$PKG_CONFIG"
substituteInPlace smartcard/scard/winscarddll.c \
--replace-fail "libpcsclite.so.1" \
"${lib.getLib pcsclite}/lib/libpcsclite${stdenv.hostPlatform.extensions.sharedLibrary}"
'';
preCheck = ''
# remove src module, so tests use the installed module instead
rm -r smartcard
'';
disabledTests = [
# AssertionError
"test_hresult"
"test_low_level"
];
meta = with lib; {
description = "Smartcard library for python";
homepage = "https://pyscard.sourceforge.io/";
changelog = "https://github.com/LudovicRousseau/pyscard/releases/tag/${version}";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ layus ];
};
}
|