1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, click
5, pyscard
6, pycountry
7, terminaltables
8, pytestCheckHook
9, pythonOlder
10}:
11
12buildPythonPackage rec {
13 pname = "emv";
14 version = "1.0.14";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.4";
18
19 src = fetchFromGitHub {
20 owner = "russss";
21 repo = "python-emv";
22 rev = "v${version}";
23 hash = "sha256-MnaeQZ0rA3i0CoUA6HgJQpwk5yo4rm9e+pc5XzRd1eg=";
24 };
25
26 propagatedBuildInputs = [
27 click
28 pyscard
29 pycountry
30 terminaltables
31 ];
32
33 nativeCheckInputs = [
34 pytestCheckHook
35 ];
36
37 postPatch = ''
38 substituteInPlace setup.py \
39 --replace '"enum-compat==0.0.3",' "" \
40 --replace '"argparse==1.4.0",' "" \
41 --replace "click==7.1.2" "click" \
42 --replace "pyscard==2.0.0" "pyscard" \
43 --replace "pycountry==20.7.3" "pycountry" \
44 --replace "terminaltables==3.1.0" "terminaltables"
45 '';
46
47 pythonImportsCheck = [
48 "emv"
49 ];
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 license = licenses.mit;
55 maintainers = with maintainers; [ lukegb ];
56 };
57}