1{
2 lib,
3 buildPythonPackage,
4 ddt,
5 fetchFromGitHub,
6 importlib-metadata,
7 jsonschema,
8 license-expression,
9 lxml,
10 packageurl-python,
11 py-serializable,
12 pythonRelaxDepsHook,
13 poetry-core,
14 pytestCheckHook,
15 pythonOlder,
16 requirements-parser,
17 sortedcontainers,
18 setuptools,
19 toml,
20 types-setuptools,
21 types-toml,
22 xmldiff,
23}:
24
25buildPythonPackage rec {
26 pname = "cyclonedx-python-lib";
27 version = "7.3.4";
28 pyproject = true;
29
30 disabled = pythonOlder "3.9";
31
32 src = fetchFromGitHub {
33 owner = "CycloneDX";
34 repo = "cyclonedx-python-lib";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-rFxCeQTCQSpg0LQYyOxhk150KOUyV9PXdXo1mOA0KPw=";
37 };
38
39 build-system = [ poetry-core ];
40
41 nativeBuildInputs = [ pythonRelaxDepsHook ];
42
43 dependencies = [
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 = [ "cyclonedx" ];
65
66 pythonRelaxDeps = [ "py-serializable" ];
67
68 preCheck = ''
69 export PYTHONPATH=tests''${PYTHONPATH+:$PYTHONPATH}
70 '';
71
72 pytestFlagsArray = [ "tests/" ];
73
74 disabledTests = [
75 # These tests require network access
76 "test_bom_v1_3_with_metadata_component"
77 "test_bom_v1_4_with_metadata_component"
78 # AssertionError: <ValidationError: "{'algorithm': 'ES256', ...
79 "TestJson"
80 ];
81
82 disabledTestPaths = [
83 # Test failures seem py-serializable related
84 "tests/test_output_xml.py"
85 ];
86
87 meta = with lib; {
88 description = "Python library for generating CycloneDX SBOMs";
89 homepage = "https://github.com/CycloneDX/cyclonedx-python-lib";
90 changelog = "https://github.com/CycloneDX/cyclonedx-python-lib/releases/tag/v${version}";
91 license = with licenses; [ asl20 ];
92 maintainers = with maintainers; [ fab ];
93 };
94}