1{
2 lib,
3 buildPythonPackage,
4 inkscape,
5 fetchpatch,
6 poetry-core,
7 cssselect,
8 lxml,
9 numpy,
10 packaging,
11 pillow,
12 pygobject3,
13 pyparsing,
14 pyserial,
15 scour,
16 gobject-introspection,
17 pytestCheckHook,
18 gtk3,
19}:
20
21buildPythonPackage {
22 pname = "inkex";
23 inherit (inkscape) version;
24
25 format = "pyproject";
26
27 inherit (inkscape) src;
28
29 patches = [
30 # Fix “distribute along path” test with Python 3.12.
31 # https://gitlab.com/inkscape/extensions/-/issues/580
32 (fetchpatch {
33 url = "https://gitlab.com/inkscape/extensions/-/commit/c576043c195cd044bdfc975e6367afb9b655eb14.patch";
34 extraPrefix = "share/extensions/";
35 stripLen = 1;
36 hash = "sha256-D9HxBx8RNkD7hHuExJqdu3oqlrXX6IOUw9m9Gx6+Dr8=";
37 })
38 ];
39
40 nativeBuildInputs = [ poetry-core ];
41
42 propagatedBuildInputs = [
43 cssselect
44 lxml
45 numpy
46 pygobject3
47 pyserial
48 ];
49
50 pythonImportsCheck = [ "inkex" ];
51
52 nativeCheckInputs = [
53 gobject-introspection
54 pytestCheckHook
55 ];
56
57 checkInputs = [
58 gtk3
59 packaging
60 pillow
61 pyparsing
62 scour
63 ];
64
65 disabledTests = [
66 "test_extract_multiple"
67 "test_lookup_and"
68 ];
69
70 disabledTestPaths = [
71 # Fatal Python error: Segmentation fault
72 "tests/test_inkex_gui.py"
73 "tests/test_inkex_gui_listview.py"
74 "tests/test_inkex_gui_window.py"
75 # Failed to find pixmap 'image-missing' in /build/source/tests/data/
76 "tests/test_inkex_gui_pixmaps.py"
77 ];
78
79 postPatch = ''
80 cd share/extensions
81
82 substituteInPlace pyproject.toml \
83 --replace-fail 'scour = "^0.37"' 'scour = ">=0.37"' \
84 --replace-fail 'lxml = "^4.5.0"' 'lxml = "^4.5.0 || ^5.0.0"'
85 '';
86
87 meta = {
88 description = "Library for manipulating SVG documents which is the basis for Inkscape extensions";
89 homepage = "https://gitlab.com/inkscape/extensions";
90 license = lib.licenses.gpl2Plus;
91 maintainers = with lib.maintainers; [ dotlambda ];
92 };
93}