diff options
author | Aaron Massey <aaronmassey@google.com> | 2023-05-02 14:41:13 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-02 23:35:38 +0000 |
commit | e419c8156fae5ddf204a8483371047db69a59bf7 (patch) | |
tree | ecab3a056ec7c6156276af68ae4e9b611675e1ee /zephyr | |
parent | 267cec2b2e75609047469e6e351355f9e100fb14 (diff) | |
download | chrome-ec-e419c8156fae5ddf204a8483371047db69a59bf7.tar.gz |
zmake: Pass python exec/paths to zephyr cmake
By default, zephyr finds a python binary on the host with no
PYTHONPATH.
Allow for greater hermeticity wrt the host building zephyr by having
zmake explicitly pass its executing python and associated PYTHONPATH to
zephyr's cmake.
BUG=b:26805032
TEST=zmake build -a
TEST=bazel build cros_firmware:build_krabby
TEST=CQ
Change-Id: Id84fe8943186fb1becafea3c800a3c6a683cf301
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4500242
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Auto-Submit: Aaron Massey <aaronmassey@google.com>
Tested-by: Aaron Massey <aaronmassey@google.com>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r-- | zephyr/zmake/zmake/jobserver.py | 5 | ||||
-rw-r--r-- | zephyr/zmake/zmake/zmake.py | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/zephyr/zmake/zmake/jobserver.py b/zephyr/zmake/zmake/jobserver.py index c1c9538b35..23a45c5e07 100644 --- a/zephyr/zmake/zmake/jobserver.py +++ b/zephyr/zmake/zmake/jobserver.py @@ -1,6 +1,7 @@ # Copyright 2020 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + """Module for job counters, limiting the amount of concurrent executions.""" import fcntl @@ -67,7 +68,9 @@ class JobClient: # By default, we scrub the environment for all commands we run, setting # the bare minimum (PATH only). This prevents us from building obscure # dependencies on the environment variables. - kwargs.setdefault("env", {"PATH": "/bin:/usr/bin"}) + kwargs.setdefault( + "env", {"PATH": "/bin:/usr/bin", "PYTHONPATH": ":".join(sys.path)} + ) kwargs.setdefault("pass_fds", []) kwargs["env"].update(self.env()) kwargs["pass_fds"] += self.pass_fds() diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py index 7457a16740..6e5f22df97 100644 --- a/zephyr/zmake/zmake/zmake.py +++ b/zephyr/zmake/zmake/zmake.py @@ -12,6 +12,7 @@ import pathlib import re import shutil import subprocess +import sys import tempfile from typing import Dict, Optional, Set, Union @@ -479,6 +480,7 @@ class Zmake: ), "ZEPHYR_BASE": str(self.zephyr_base), "ZMAKE_INCLUDE_DIR": str(generated_include_dir), + "PYTHON_PREFER": sys.executable, **( {"EXTRA_EC_VERSION_FLAGS": "--static"} if static_version |