1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 cryptography,
6 fetchFromGitHub,
7 fonttools,
8 lxml,
9 matplotlib,
10 pandas,
11 pillow,
12 python-barcode,
13 pythonOlder,
14 qrcode,
15 pytestCheckHook,
16 requests,
17 setuptools,
18}:
19
20buildPythonPackage rec {
21 pname = "borb";
22 version = "2.1.25";
23 pyproject = true;
24
25 disabled = pythonOlder "3.6";
26
27 src = fetchFromGitHub {
28 owner = "jorisschellekens";
29 repo = "borb";
30 tag = "v${version}";
31 hash = "sha256-eVxpcYL3ZgwidkSt6tUav3Bkne4lo1QCshdUFqkA0wI=";
32 };
33
34 # ModuleNotFoundError: No module named '_decimal'
35 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
36 grep -Rl 'from _decimal' tests/ | while read -r test_file; do
37 substituteInPlace "$test_file" \
38 --replace-fail 'from _decimal' 'from decimal'
39 done
40 '';
41
42 build-system = [ setuptools ];
43
44 dependencies = [
45 cryptography
46 fonttools
47 lxml
48 pillow
49 python-barcode
50 qrcode
51 requests
52 setuptools
53 ];
54
55 nativeCheckInputs = [
56 matplotlib
57 pandas
58 pytestCheckHook
59 ];
60
61 pythonImportsCheck = [ "borb.pdf" ];
62
63 disabledTests = [
64 "test_code_files_are_small"
65 "test_image_has_pdfobject_methods"
66 ];
67
68 disabledTestPaths = [
69 # Tests require network access
70 "tests/pdf/"
71 "tests/toolkit/"
72 "tests/license/"
73 ];
74
75 meta = {
76 description = "Library for reading, creating and manipulating PDF files in Python";
77 homepage = "https://borbpdf.com/";
78 changelog = "https://github.com/jorisschellekens/borb/releases/tag/v${version}";
79 license = lib.licenses.agpl3Only;
80 maintainers = with lib.maintainers; [ getchoo ];
81 };
82}