Skip to content

Commit 493ceb4

Browse files
authored
Merge pull request #656 from tiran/max_jobs-substitute
fix: add `MAX_JOBS` to env substitution mapping
2 parents 8206a77 + 17d222c commit 493ceb4

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/fromager/packagesettings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,9 @@ def get_extra_environ(
773773
"MAX_JOBS": str(jobs),
774774
}
775775

776+
# make MAX_JOBS available to substitution
777+
template_env.update(extra_environ)
778+
776779
# add VIRTUAL_ENV and update PATH, so templates can use the values
777780
if build_env is not None:
778781
venv_environ = build_env.get_venv_environ(template_env=template_env)

tests/test_packagesettings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"SPAM": "alot $EXTRA",
5555
"QUOTES": "A\"BC'$$EGG",
5656
"DEF": "${DEF:-default}",
57+
"EXTRA_MAX_JOBS": "${MAX_JOBS}",
5758
},
5859
"git_options": {
5960
"submodules": False,
@@ -166,6 +167,7 @@ def test_pbi_test_pkg_extra_environ(
166167
"CMAKE_BUILD_PARALLEL_LEVEL": "1",
167168
"MAKEFLAGS": "-j1",
168169
"MAX_JOBS": "1",
170+
"EXTRA_MAX_JOBS": "1",
169171
}
170172

171173
pbi = testdata_context.settings.package_build_info(TEST_PKG)

tests/testdata/context/overrides/settings/test_pkg.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ env:
1919
SPAM: "alot $EXTRA"
2020
QUOTES: "A\"BC'$$EGG"
2121
DEF: "${DEF:-default}"
22+
EXTRA_MAX_JOBS: "${MAX_JOBS}"
2223
download_source:
2324
url: https://egg.test/${canonicalized_name}/v${version}.tar.gz
2425
destination_filename: ${canonicalized_name}-${version}.tar.gz

0 commit comments

Comments
 (0)