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
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/craft_parts/executor/step_handler.py b/craft_parts/executor/step_handler.py
2
+
index 404df69..f90e2ac 100644
3
+
--- a/craft_parts/executor/step_handler.py
4
+
+++ b/craft_parts/executor/step_handler.py
5
+
@@ -243,8 +243,9 @@ class StepHandler:
6
+
print(script, file=script_file)
7
+
script_file.flush()
8
+
script_file.seek(0)
9
+
+ import shutil
10
+
process = subprocess.Popen( # pylint: disable=consider-using-with
11
+
- ["/bin/bash"],
12
+
+ [shutil.which("bash")],
13
+
stdin=script_file,
14
+
cwd=work_dir,
15
+
stdout=self._stdout,
16
+
@@ -394,7 +395,8 @@ def _create_and_run_script(
17
+
) -> None:
18
+
"""Create a script with step-specific commands and execute it."""
19
+
with script_path.open("w") as run_file:
20
+
- print("#!/bin/bash", file=run_file)
21
+
+ import shutil
22
+
+ print(f"#!{shutil.which('bash')}", file=run_file)
23
+
print("set -euo pipefail", file=run_file)
24
+
25
+
if build_environment_script_path:
26
+
diff --git a/craft_parts/plugins/validator.py b/craft_parts/plugins/validator.py
27
+
index b8d8f11..fce0e72 100644
28
+
--- a/craft_parts/plugins/validator.py
29
+
+++ b/craft_parts/plugins/validator.py
30
+
@@ -142,9 +142,9 @@ class PluginEnvironmentValidator:
31
+
print(self._env, file=env_file)
32
+
print(cmd, file=env_file)
33
+
env_file.flush()
34
+
-
35
+
+ import shutil
36
+
proc = subprocess.run(
37
+
- ["/bin/bash", env_file.name],
38
+
+ [shutil.which("bash"), env_file.name],
39
+
check=True,
40
+
capture_output=True,
41
+
text=True,
+119
pkgs/development/python-modules/craft-parts/default.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ lib
2
+
, buildPythonPackage
3
+
, fetchFromGitHub
4
+
, nix-update-script
5
+
, overrides
6
+
, pydantic_1
7
+
, pydantic-yaml-0
8
+
, pyxdg
9
+
, pyyaml
10
+
, requests
11
+
, requests-unixsocket
12
+
, types-pyyaml
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
+
}:
25
+
26
+
buildPythonPackage rec {
27
+
pname = "craft-parts";
28
+
version = "1.26.2";
29
+
30
+
pyproject = true;
31
+
32
+
src = fetchFromGitHub {
33
+
owner = "canonical";
34
+
repo = "craft-parts";
35
+
rev = "refs/tags/${version}";
36
+
hash = "sha256-wHv0JWffS916RK4Kgk+FuRthx+ajh0Ka4DBwGrLdUBs=";
37
+
};
38
+
39
+
patches = [
40
+
./bash-path.patch
41
+
];
42
+
43
+
postPatch = ''
44
+
substituteInPlace setup.py \
45
+
--replace-fail "pydantic-yaml[pyyaml]>=0.11.0,<1.0.0" "pydantic-yaml[pyyaml]" \
46
+
--replace-fail "urllib3<2" "urllib3"
47
+
'';
48
+
49
+
nativeBuildInputs = [
50
+
setuptools
51
+
setuptools-scm
52
+
];
53
+
54
+
propagatedBuildInputs = [
55
+
overrides
56
+
pydantic_1
57
+
pydantic-yaml-0
58
+
pyxdg
59
+
pyyaml
60
+
requests
61
+
requests-unixsocket
62
+
types-pyyaml
63
+
urllib3
64
+
];
65
+
66
+
pythonImportsCheck = [
67
+
"craft_parts"
68
+
];
69
+
70
+
nativeCheckInputs = [
71
+
git
72
+
hypothesis
73
+
pytest-check
74
+
pytest-mock
75
+
pytest-subprocess
76
+
pytestCheckHook
77
+
requests-mock
78
+
squashfsTools
79
+
];
80
+
81
+
pytestFlagsArray = [ "tests/unit" ];
82
+
83
+
preCheck = ''
84
+
export HOME=$(mktemp -d)
85
+
'';
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
+
];
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
+
108
+
passthru.updateScript = nix-update-script { };
109
+
110
+
meta = {
111
+
description = "Software artifact parts builder from Canonical";
112
+
homepage = "https://github.com/canonical/craft-parts";
113
+
changelog = "https://github.com/canonical/craft-parts/releases/tag/${version}";
114
+
license = lib.licenses.lgpl3Only;
115
+
maintainers = with lib.maintainers; [ jnsgruk ];
116
+
platforms = lib.platforms.linux;
117
+
};
118
+
}
119
+
+2
pkgs/top-level/python-packages.nix
···
2447
2448
cpyparsing = callPackage ../development/python-modules/cpyparsing { };
2449
0
0
2450
craft-providers = callPackage ../development/python-modules/craft-providers { };
2451
2452
cram = callPackage ../development/python-modules/cram { };
···
2447
2448
cpyparsing = callPackage ../development/python-modules/cpyparsing { };
2449
2450
+
craft-parts = callPackage ../development/python-modules/craft-parts { };
2451
+
2452
craft-providers = callPackage ../development/python-modules/craft-providers { };
2453
2454
cram = callPackage ../development/python-modules/cram { };