about summary refs log tree commit diff
path: root/pkgs/development/python-modules/qrcode/default.nix
blob: 2c7df77b33a1082a10f5c3ec0ce0dd2a4ea1e683 (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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  mock,
  pillow,
  pypng,
  pytestCheckHook,
  pythonAtLeast,
  qrcode,
  setuptools,
  testers,
  typing-extensions,
}:

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

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-ndlpRUgn4Sfb2TaWsgdHI55tVA4IKTfJDxSslbMPWEU=";
  };

  nativeBuildInputs = [ setuptools ];

  propagatedBuildInputs = [
    typing-extensions
    pypng
    # imports pkg_resouces in console_scripts.py
    setuptools
  ];

  passthru.optional-dependencies.pil = [ pillow ];

  nativeCheckInputs = [
    mock
    pytestCheckHook
  ] ++ passthru.optional-dependencies.pil;

  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 = with lib; {
    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 = licenses.bsd3;
    maintainers = [ ];
  };
}