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