1{ lib
2, buildPythonPackage
3, ddt
4, fetchFromGitHub
5, importlib-metadata
6, jsonschema
7, license-expression
8, lxml
9, packageurl-python
10, py-serializable
11, pythonRelaxDepsHook
12, poetry-core
13, pytestCheckHook
14, pythonOlder
15, requirements-parser
16, sortedcontainers
17, setuptools
18, toml
19, types-setuptools
20, types-toml
21, xmldiff
22}:
23
24buildPythonPackage rec {
25 pname = "cyclonedx-python-lib";
26 version = "4.2.2";
27 format = "pyproject";
28
29 disabled = pythonOlder "3.9";
30
31 src = fetchFromGitHub {
32 owner = "CycloneDX";
33 repo = pname;
34 rev = "refs/tags/v${version}";
35 hash = "sha256-7bqIKwKGfMj5YPqZpvWtP881LNOgvJ+DMHs1U63gCN0=";
36 };
37
38 nativeBuildInputs = [
39 poetry-core
40 pythonRelaxDepsHook
41 ];
42
43 propagatedBuildInputs = [
44 importlib-metadata
45 license-expression
46 packageurl-python
47 requirements-parser
48 setuptools
49 sortedcontainers
50 toml
51 py-serializable
52 types-setuptools
53 types-toml
54 ];
55
56 nativeCheckInputs = [
57 ddt
58 jsonschema
59 lxml
60 pytestCheckHook
61 xmldiff
62 ];
63
64 pythonImportsCheck = [
65 "cyclonedx"
66 ];
67
68 pythonRelaxDeps = [
69 "py-serializable"
70 ];
71
72 preCheck = ''
73 export PYTHONPATH=tests''${PYTHONPATH+:$PYTHONPATH}
74 '';
75
76 pytestFlagsArray = [
77 "tests/"
78 ];
79
80 disabledTests = [
81 # These tests require network access.
82 "test_bom_v1_3_with_metadata_component"
83 "test_bom_v1_4_with_metadata_component"
84 ];
85
86 meta = with lib; {
87 description = "Python library for generating CycloneDX SBOMs";
88 homepage = "https://github.com/CycloneDX/cyclonedx-python-lib";
89 changelog = "https://github.com/CycloneDX/cyclonedx-python-lib/releases/tag/v${version}";
90 license = with licenses; [ asl20 ];
91 maintainers = with maintainers; [ fab ];
92 };
93}