summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-02-08 15:34:11 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-10 17:33:41 +0000
commitfbdf09e8672aa541f1f6d150691f921784b58761 (patch)
tree5196554a29c3d15615234254c615dc33384aaace /zephyr
parentb536a1d74978ffde64085c335302c8e7aa27329c (diff)
downloadchrome-ec-fbdf09e8672aa541f1f6d150691f921784b58761.tar.gz
zephyr: zmake: delay locating CrOS checkout
For building outside of a ChromeOS environment, a user may have their own choice of where they put all of the repos for building Zephyr, and using the ChromeOS directory structure to find the repos in this case is unwanted. This also applies to the case where we have an ebuild to build the sources, cros-workon will locate the sources in different paths. We delay the evaluation of util.locate_cros_checkout until the code actually uses it, allowing us to not pass a checkout or locate one unless we actually need it. BUG=b:179813084 BRANCH=none TEST=zmake testall (note nothing useful for getting -m working yet, requires follow-on CLs) Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5e0c6be294d907cf9ed528d2f938303c9fa8f275 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685473 Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/zmake/zmake/zmake.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index ae3b3f8b1f..217e66bae6 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -38,11 +38,7 @@ def ninja_log_level_override(line, default_log_level):
class Zmake:
"""Wrapper class encapsulating zmake's supported operations."""
def __init__(self, checkout=None, jobserver=None, jobs=0):
- if checkout:
- self.checkout = pathlib.Path(checkout)
- else:
- self.checkout = util.locate_cros_checkout()
- assert self.checkout.exists()
+ self._checkout = checkout
if jobserver:
self.jobserver = jobserver
@@ -54,6 +50,12 @@ class Zmake:
self.logger = logging.getLogger(self.__class__.__name__)
+ @property
+ def checkout(self):
+ if not self._checkout:
+ self._checkout = util.locate_cros_checkout()
+ return self._checkout.resolve()
+
def configure(self, project_dir, build_dir=None,
version=None, zephyr_base=None, module_paths=None,
toolchain=None, ignore_unsupported_zephyr_version=False,