1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 mock,
6 pillow,
7 pypng,
8 pytestCheckHook,
9 pythonAtLeast,
10 qrcode,
11 setuptools,
12 testers,
13 typing-extensions,
14}:
15
16buildPythonPackage rec {
17 pname = "qrcode";
18 version = "7.4.2";
19 pyproject = true;
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-ndlpRUgn4Sfb2TaWsgdHI55tVA4IKTfJDxSslbMPWEU=";
24 };
25
26 nativeBuildInputs = [ setuptools ];
27
28 propagatedBuildInputs = [
29 typing-extensions
30 pypng
31 # imports pkg_resouces in console_scripts.py
32 setuptools
33 ];
34
35 passthru.optional-dependencies.pil = [ pillow ];
36
37 nativeCheckInputs = [
38 mock
39 pytestCheckHook
40 ] ++ passthru.optional-dependencies.pil;
41
42 passthru.tests = {
43 version = testers.testVersion {
44 package = qrcode;
45 command = "qr --version";
46 };
47 };
48
49 disabledTests = lib.optionals (pythonAtLeast "3.12") [ "test_change" ] ++ [
50 # Attempts to open a file which doesn't exist in sandbox
51 "test_piped"
52 ];
53
54 meta = with lib; {
55 description = "Python QR Code image generator";
56 mainProgram = "qr";
57 homepage = "https://github.com/lincolnloop/python-qrcode";
58 changelog = "https://github.com/lincolnloop/python-qrcode/blob/v${version}/CHANGES.rst";
59 license = licenses.bsd3;
60 maintainers = [ ];
61 };
62}