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