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