1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6 overrides,
7 pydantic,
8 pyxdg,
9 pyyaml,
10 requests,
11 requests-unixsocket,
12 pyfakefs,
13 pytestCheckHook,
14 pytest-check,
15 pytest-mock,
16 pytest-subprocess,
17 requests-mock,
18 hypothesis,
19 jsonschema,
20 git,
21 squashfsTools,
22 socat,
23 setuptools-scm,
24 stdenv,
25 ant,
26 maven,
27 jdk,
28 writableTmpDirAsHomeHook,
29}:
30
31buildPythonPackage rec {
32 pname = "craft-parts";
33 version = "2.18.0";
34
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "canonical";
39 repo = "craft-parts";
40 tag = version;
41 hash = "sha256-mjmWB6kgQNY++aAb9Ql/1cISGqX1mivz62y0Sa65FwM=";
42 };
43
44 patches = [ ./bash-path.patch ];
45
46 build-system = [ setuptools-scm ];
47
48 pythonRelaxDeps = [
49 "requests"
50 "urllib3"
51 "pydantic"
52 ];
53
54 dependencies = [
55 overrides
56 pydantic
57 pyxdg
58 pyyaml
59 requests
60 requests-unixsocket
61 ];
62
63 pythonImportsCheck = [ "craft_parts" ];
64
65 nativeCheckInputs = [
66 ant
67 git
68 hypothesis
69 jdk
70 jsonschema
71 maven
72 pyfakefs
73 pytest-check
74 pytest-mock
75 pytest-subprocess
76 pytestCheckHook
77 requests-mock
78 socat
79 squashfsTools
80 writableTmpDirAsHomeHook
81 ];
82
83 enabledTestPaths = [ "tests/unit" ];
84
85 disabledTests = [
86 # Relies upon paths not present in Nix (like /bin/bash)
87 "test_run_builtin_build"
88 "test_run_prime"
89 "test_get_build_packages_with_source_type"
90 "test_get_build_packages"
91 # Relies upon certain paths being present that don't make sense on Nix.
92 "test_java_plugin_jre_not_17"
93 ];
94
95 disabledTestPaths = [
96 # Relies upon filesystem extended attributes, and suid/guid bits
97 "tests/unit/sources/test_base.py"
98 "tests/unit/packages/test_base.py"
99 "tests/unit/state_manager"
100 "tests/unit/test_xattrs.py"
101 "tests/unit/packages/test_normalize.py"
102 # Relies upon presence of apt/dpkg.
103 "tests/unit/packages/test_apt_cache.py"
104 "tests/unit/packages/test_deb.py"
105 "tests/unit/packages/test_chisel.py"
106 ]
107 ++ lib.optionals stdenv.hostPlatform.isAarch64 [
108 # These tests have hardcoded "amd64" strings which fail on aarch64
109 "tests/unit/executor/test_environment.py"
110 "tests/unit/features/overlay/test_executor_environment.py"
111 # Hard-coded assumptions about arguments relating to 'x86_64'
112 "tests/unit/plugins/test_dotnet_v2_plugin.py"
113 ];
114
115 passthru.updateScript = nix-update-script { };
116
117 meta = {
118 description = "Software artifact parts builder from Canonical";
119 homepage = "https://github.com/canonical/craft-parts";
120 changelog = "https://github.com/canonical/craft-parts/releases/tag/${src.tag}";
121 license = lib.licenses.lgpl3Only;
122 maintainers = with lib.maintainers; [ jnsgruk ];
123 platforms = lib.platforms.linux;
124 };
125}