1{
2 lib,
3 beartype,
4 buildPythonPackage,
5 click,
6 fetchFromGitHub,
7 fetchpatch,
8 license-expression,
9 ply,
10 pytestCheckHook,
11 pyyaml,
12 rdflib,
13 semantic-version,
14 setuptools,
15 setuptools-scm,
16 uritools,
17 xmltodict,
18}:
19
20buildPythonPackage rec {
21 pname = "spdx-tools";
22 version = "0.8.3";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "spdx";
27 repo = "tools-python";
28 tag = "v${version}";
29 hash = "sha256-r7+RYGoq3LJYN1jYfwzb1r3fc/kL+CPd4pmGATFq8Pw=";
30 };
31
32 patches = [
33 # https://github.com/spdx/tools-python/issues/844
34 (fetchpatch {
35 name = "beartype-0.20-compat.patch";
36 url = "https://github.com/spdx/tools-python/pull/841/commits/3b13bd5af36a2b78f5c87fdbadc3f2601d2dcd8d.patch";
37 hash = "sha256-8sQNGRss4R1olsw+xGps3NICyimBxKv47TaSrCcnVhA=";
38 })
39 ];
40
41 build-system = [
42 setuptools
43 setuptools-scm
44 ];
45
46 dependencies = [
47 beartype
48 click
49 license-expression
50 ply
51 pyyaml
52 rdflib
53 semantic-version
54 uritools
55 xmltodict
56 ];
57
58 nativeCheckInputs = [ pytestCheckHook ];
59
60 pythonImportsCheck = [ "spdx_tools.spdx" ];
61
62 disabledTestPaths = [
63 # Test depends on the currently not packaged pyshacl module
64 "tests/spdx3/validation/json_ld/test_shacl_validation.py"
65 ];
66
67 disabledTests = [
68 # Missing files
69 "test_spdx2_convert_to_spdx3"
70 "test_json_writer"
71 ];
72
73 meta = with lib; {
74 description = "SPDX parser and tools";
75 homepage = "https://github.com/spdx/tools-python";
76 changelog = "https://github.com/spdx/tools-python/blob/v${version}/CHANGELOG.md";
77 license = licenses.asl20;
78 maintainers = with maintainers; [ fab ];
79 };
80}