1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 click,
6 pyscard,
7 pycountry,
8 terminaltables,
9 pytestCheckHook,
10 setuptools,
11 pythonOlder,
12}:
13
14buildPythonPackage rec {
15 pname = "emv";
16 version = "1.0.14";
17 pyproject = true;
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "russss";
23 repo = "python-emv";
24 tag = "v${version}";
25 hash = "sha256-MnaeQZ0rA3i0CoUA6HgJQpwk5yo4rm9e+pc5XzRd1eg=";
26 };
27
28 postPatch = ''
29 substituteInPlace setup.py \
30 --replace-fail '"enum-compat==0.0.3",' "" \
31 --replace-fail '"argparse==1.4.0",' "" \
32 --replace-fail "click==7.1.2" "click" \
33 --replace-fail "pyscard==2.0.0" "pyscard" \
34 --replace-fail "pycountry==20.7.3" "pycountry" \
35 --replace-fail "terminaltables==3.1.0" "terminaltables"
36 '';
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 click
42 pyscard
43 pycountry
44 terminaltables
45 ];
46
47 nativeCheckInputs = [ pytestCheckHook ];
48
49 pythonImportsCheck = [ "emv" ];
50
51 meta = with lib; {
52 description = "Implementation of the EMV chip-and-pin smartcard protocol";
53 homepage = "https://github.com/russss/python-emv";
54 changelog = "https://github.com/russss/python-emv/releases/tag/v${version}";
55 license = licenses.mit;
56 maintainers = with maintainers; [ lukegb ];
57 mainProgram = "emvtool";
58 };
59}