summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/qrcode/default.nix
blob: bc1bd5b86a4d55ffc141a7c77b2fea0fe6485c46 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,

  # build-system
  poetry-core,

  # dependencies
  pillow,
  pypng,

  # tests
  mock,
  pytestCheckHook,
  qrcode,
  testers,
}:

buildPythonPackage rec {
  pname = "qrcode";
  version = "8.2";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "lincolnloop";
    repo = "python-qrcode";
    tag = "v${version}";
    hash = "sha256-qLIYUFnBJQGidnfC0bQAkO/aUmT94uXFMeMhnUgUnfQ=";
  };

  build-system = [ poetry-core ];

  optional-dependencies = {
    pil = [ pillow ];
    png = [ pypng ];
    all = [
      pypng
      pillow
    ];
  };

  nativeCheckInputs = [
    mock
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  passthru.tests = {
    version = testers.testVersion {
      package = qrcode;
      command = "qr --version";
    };
  };

  disabledTests = lib.optionals (pythonAtLeast "3.12") [ "test_change" ] ++ [
    # Attempts to open a file which doesn't exist in sandbox
    "test_piped"
  ];

  meta = {
    description = "Python QR Code image generator";
    mainProgram = "qr";
    homepage = "https://github.com/lincolnloop/python-qrcode";
    changelog = "https://github.com/lincolnloop/python-qrcode/blob/v${version}/CHANGES.rst";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ attila ];
  };
}