tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
python3Packages.craft-parts: init at 1.26.2
Jon Seager
2 years ago
3582633b
bbc690a0
+162
3 changed files
expand all
collapse all
unified
split
pkgs
development
python-modules
craft-parts
bash-path.patch
default.nix
top-level
python-packages.nix
+41
pkgs/development/python-modules/craft-parts/bash-path.patch
···
1
1
+
diff --git a/craft_parts/executor/step_handler.py b/craft_parts/executor/step_handler.py
2
2
+
index 404df69..f90e2ac 100644
3
3
+
--- a/craft_parts/executor/step_handler.py
4
4
+
+++ b/craft_parts/executor/step_handler.py
5
5
+
@@ -243,8 +243,9 @@ class StepHandler:
6
6
+
print(script, file=script_file)
7
7
+
script_file.flush()
8
8
+
script_file.seek(0)
9
9
+
+ import shutil
10
10
+
process = subprocess.Popen( # pylint: disable=consider-using-with
11
11
+
- ["/bin/bash"],
12
12
+
+ [shutil.which("bash")],
13
13
+
stdin=script_file,
14
14
+
cwd=work_dir,
15
15
+
stdout=self._stdout,
16
16
+
@@ -394,7 +395,8 @@ def _create_and_run_script(
17
17
+
) -> None:
18
18
+
"""Create a script with step-specific commands and execute it."""
19
19
+
with script_path.open("w") as run_file:
20
20
+
- print("#!/bin/bash", file=run_file)
21
21
+
+ import shutil
22
22
+
+ print(f"#!{shutil.which('bash')}", file=run_file)
23
23
+
print("set -euo pipefail", file=run_file)
24
24
+
25
25
+
if build_environment_script_path:
26
26
+
diff --git a/craft_parts/plugins/validator.py b/craft_parts/plugins/validator.py
27
27
+
index b8d8f11..fce0e72 100644
28
28
+
--- a/craft_parts/plugins/validator.py
29
29
+
+++ b/craft_parts/plugins/validator.py
30
30
+
@@ -142,9 +142,9 @@ class PluginEnvironmentValidator:
31
31
+
print(self._env, file=env_file)
32
32
+
print(cmd, file=env_file)
33
33
+
env_file.flush()
34
34
+
-
35
35
+
+ import shutil
36
36
+
proc = subprocess.run(
37
37
+
- ["/bin/bash", env_file.name],
38
38
+
+ [shutil.which("bash"), env_file.name],
39
39
+
check=True,
40
40
+
capture_output=True,
41
41
+
text=True,
+119
pkgs/development/python-modules/craft-parts/default.nix
···
1
1
+
{ lib
2
2
+
, buildPythonPackage
3
3
+
, fetchFromGitHub
4
4
+
, nix-update-script
5
5
+
, overrides
6
6
+
, pydantic_1
7
7
+
, pydantic-yaml-0
8
8
+
, pyxdg
9
9
+
, pyyaml
10
10
+
, requests
11
11
+
, requests-unixsocket
12
12
+
, types-pyyaml
13
13
+
, urllib3
14
14
+
, pytestCheckHook
15
15
+
, pytest-check
16
16
+
, pytest-mock
17
17
+
, pytest-subprocess
18
18
+
, requests-mock
19
19
+
, hypothesis
20
20
+
, git
21
21
+
, squashfsTools
22
22
+
, setuptools
23
23
+
, setuptools-scm
24
24
+
}:
25
25
+
26
26
+
buildPythonPackage rec {
27
27
+
pname = "craft-parts";
28
28
+
version = "1.26.2";
29
29
+
30
30
+
pyproject = true;
31
31
+
32
32
+
src = fetchFromGitHub {
33
33
+
owner = "canonical";
34
34
+
repo = "craft-parts";
35
35
+
rev = "refs/tags/${version}";
36
36
+
hash = "sha256-wHv0JWffS916RK4Kgk+FuRthx+ajh0Ka4DBwGrLdUBs=";
37
37
+
};
38
38
+
39
39
+
patches = [
40
40
+
./bash-path.patch
41
41
+
];
42
42
+
43
43
+
postPatch = ''
44
44
+
substituteInPlace setup.py \
45
45
+
--replace-fail "pydantic-yaml[pyyaml]>=0.11.0,<1.0.0" "pydantic-yaml[pyyaml]" \
46
46
+
--replace-fail "urllib3<2" "urllib3"
47
47
+
'';
48
48
+
49
49
+
nativeBuildInputs = [
50
50
+
setuptools
51
51
+
setuptools-scm
52
52
+
];
53
53
+
54
54
+
propagatedBuildInputs = [
55
55
+
overrides
56
56
+
pydantic_1
57
57
+
pydantic-yaml-0
58
58
+
pyxdg
59
59
+
pyyaml
60
60
+
requests
61
61
+
requests-unixsocket
62
62
+
types-pyyaml
63
63
+
urllib3
64
64
+
];
65
65
+
66
66
+
pythonImportsCheck = [
67
67
+
"craft_parts"
68
68
+
];
69
69
+
70
70
+
nativeCheckInputs = [
71
71
+
git
72
72
+
hypothesis
73
73
+
pytest-check
74
74
+
pytest-mock
75
75
+
pytest-subprocess
76
76
+
pytestCheckHook
77
77
+
requests-mock
78
78
+
squashfsTools
79
79
+
];
80
80
+
81
81
+
pytestFlagsArray = [ "tests/unit" ];
82
82
+
83
83
+
preCheck = ''
84
84
+
export HOME=$(mktemp -d)
85
85
+
'';
86
86
+
87
87
+
disabledTests = [
88
88
+
# Relies upon paths not present in Nix (like /bin/bash)
89
89
+
"test_run_builtin_build"
90
90
+
"test_run_prime"
91
91
+
"test_get_build_packages_with_source_type"
92
92
+
"test_get_build_packages"
93
93
+
];
94
94
+
95
95
+
disabledTestPaths = [
96
96
+
# Relies upon filesystem extended attributes, and suid/guid bits
97
97
+
"tests/unit/sources/test_base.py"
98
98
+
"tests/unit/packages/test_base.py"
99
99
+
"tests/unit/state_manager"
100
100
+
"tests/unit/test_xattrs.py"
101
101
+
"tests/unit/packages/test_normalize.py"
102
102
+
# Relies upon presence of apt/dpkg.
103
103
+
"tests/unit/packages/test_apt_cache.py"
104
104
+
"tests/unit/packages/test_deb.py"
105
105
+
"tests/unit/packages/test_chisel.py"
106
106
+
];
107
107
+
108
108
+
passthru.updateScript = nix-update-script { };
109
109
+
110
110
+
meta = {
111
111
+
description = "Software artifact parts builder from Canonical";
112
112
+
homepage = "https://github.com/canonical/craft-parts";
113
113
+
changelog = "https://github.com/canonical/craft-parts/releases/tag/${version}";
114
114
+
license = lib.licenses.lgpl3Only;
115
115
+
maintainers = with lib.maintainers; [ jnsgruk ];
116
116
+
platforms = lib.platforms.linux;
117
117
+
};
118
118
+
}
119
119
+
+2
pkgs/top-level/python-packages.nix
···
2447
2447
2448
2448
cpyparsing = callPackage ../development/python-modules/cpyparsing { };
2449
2449
2450
2450
+
craft-parts = callPackage ../development/python-modules/craft-parts { };
2451
2451
+
2450
2452
craft-providers = callPackage ../development/python-modules/craft-providers { };
2451
2453
2452
2454
cram = callPackage ../development/python-modules/cram { };