summaryrefslogtreecommitdiff
path: root/zephyr/zmake
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2022-02-11 04:56:11 +0000
committerEvan Benn <evanbenn@chromium.org>2022-02-11 05:37:49 +0000
commit59e9e0544ec4e449b11267053e5525d6de372a39 (patch)
tree0b67759b8f7da59608ecd12e51f501c317de93ee /zephyr/zmake
parent6d66fb0a7faa16f46135cc41b9b978eb7ac15337 (diff)
downloadchrome-ec-59e9e0544ec4e449b11267053e5525d6de372a39.tar.gz
Revert "zephyr: zmake: Drop support for building by project directory"
This reverts commit 848a4a66b61a656d0bd0739526656f67213ee66e. Reason for revert: broke trogdor-zephyr https://ci.chromium.org/p/chromeos/builders/postsubmit/trogdor-zephyr-postsubmit Original change's description: > zephyr: zmake: Drop support for building by project directory > > This has been deprecated since November, and all code and > documentation has been updated to no longer mention building by > project directory path. Therefore, let's drop support for it. > > BUG=b:218868887 > BRANCH=none > TEST=unit tests pass > > Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> > Change-Id: I4f0762df289a413007a8409c6a39026db8056937 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3452934 > Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Bug: b:218868887 Change-Id: I59f593aef0b9490a35b22c65d50bf5f978e56eb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454742 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Evan Benn <evanbenn@chromium.org> Tested-by: Evan Benn <evanbenn@chromium.org> Owners-Override: Evan Benn <evanbenn@chromium.org>
Diffstat (limited to 'zephyr/zmake')
-rw-r--r--zephyr/zmake/README.md4
-rw-r--r--zephyr/zmake/zmake/__main__.py4
-rw-r--r--zephyr/zmake/zmake/zmake.py19
3 files changed, 17 insertions, 10 deletions
diff --git a/zephyr/zmake/README.md b/zephyr/zmake/README.md
index 6eb573154c..63144a32db 100644
--- a/zephyr/zmake/README.md
+++ b/zephyr/zmake/README.md
@@ -35,13 +35,13 @@ Chromium OS's meta-build tool for Zephyr
### zmake configure
-**Usage:** `zmake configure [-h] [-t TOOLCHAIN] [--bringup] [--clobber] [--allow-warnings] [-B BUILD_DIR] [-b] [--test] project_name [-c]`
+**Usage:** `zmake configure [-h] [-t TOOLCHAIN] [--bringup] [--clobber] [--allow-warnings] [-B BUILD_DIR] [-b] [--test] project_name_or_dir [-c]`
#### Positional Arguments
| | |
|---|---|
-| `project_name` | Name of the project to setup |
+| `project_name_or_dir` | Path to the project to build |
#### Optional Arguments
diff --git a/zephyr/zmake/zmake/__main__.py b/zephyr/zmake/zmake/__main__.py
index ab60a00657..ce0588e5fa 100644
--- a/zephyr/zmake/zmake/__main__.py
+++ b/zephyr/zmake/zmake/__main__.py
@@ -216,8 +216,8 @@ def get_argparser():
help="Test the .elf file after configuration",
)
configure.add_argument(
- "project_name",
- help="Name of the project to setup",
+ "project_name_or_dir",
+ help="Path to the project to build",
)
configure.add_argument(
"-c",
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index bb85d12b2d..604a886815 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -192,7 +192,7 @@ class Zmake:
def configure(
self,
- project_name,
+ project_name_or_dir,
build_dir=None,
toolchain=None,
build_after_configure=False,
@@ -203,12 +203,19 @@ class Zmake:
allow_warnings=False,
):
"""Locate a project by name or directory and then call _configure."""
- root_dir = self.module_paths["ec"] / "zephyr"
+ root_dir = pathlib.Path(project_name_or_dir)
+ if not root_dir.is_dir():
+ root_dir = self.module_paths["ec"] / "zephyr"
found_projects = zmake.project.find_projects(root_dir)
- try:
- project = found_projects[project_name]
- except KeyError as e:
- raise KeyError(f"No project named {project_name}") from e
+ if len(found_projects) == 1:
+ # Likely passed directory path, wants to build only
+ # project from there.
+ project = next(iter(found_projects.values()))
+ else:
+ try:
+ project = found_projects[project_name_or_dir]
+ except KeyError as e:
+ raise KeyError("No project named {}".format(project_name_or_dir)) from e
return self._configure(
project=project,
build_dir=build_dir,