nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, importlib-metadata
5, jsonschema
6, lxml
7, packageurl-python
8, poetry-core
9, python
10, pythonOlder
11, requirements-parser
12, setuptools
13, toml
14, types-setuptools
15, types-toml
16, xmldiff
17}:
18
19buildPythonPackage rec {
20 pname = "cyclonedx-python-lib";
21 version = "2.4.0";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "CycloneDX";
28 repo = pname;
29 rev = "refs/tags/v${version}";
30 hash = "sha256-IrMXHWeksEmON3LxJvQ3WSKwQTY0aRZ8XItWMr3p4gw=";
31 };
32
33 nativeBuildInputs = [
34 poetry-core
35 ];
36
37 propagatedBuildInputs = [
38 importlib-metadata
39 packageurl-python
40 requirements-parser
41 setuptools
42 toml
43 types-setuptools
44 types-toml
45 ];
46
47 checkInputs = [
48 jsonschema
49 lxml
50 xmldiff
51 ];
52
53 pythonImportsCheck = [
54 "cyclonedx"
55 ];
56
57 checkPhase = ''
58 runHook preCheck
59 # Tests require network access
60 rm tests/test_output_json.py
61 ${python.interpreter} -m unittest discover -s tests -v
62 runHook postCheck
63 '';
64
65 meta = with lib; {
66 description = "Python library for generating CycloneDX SBOMs";
67 homepage = "https://github.com/CycloneDX/cyclonedx-python-lib";
68 license = with licenses; [ asl20 ];
69 maintainers = with maintainers; [ fab ];
70 };
71}