summaryrefslogtreecommitdiff
path: root/zephyr/zmake/zmake/build_config.py
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-07-02 11:41:24 -0600
committerCommit Bot <commit-bot@chromium.org>2021-07-12 19:15:42 +0000
commit6580c97e48e7abca694f8f5d3e955bdf12a6ec55 (patch)
treebcda10463444802c8004fb46b4cb86ef5bc3a017 /zephyr/zmake/zmake/build_config.py
parent0a639566d7e7769b7f627614c3359128c0c42763 (diff)
downloadchrome-ec-6580c97e48e7abca694f8f5d3e955bdf12a6ec55.tar.gz
zephyr: zmake: run black on all files, enable check in run_tests.sh
Run black on all files. Enable check in run_tests.sh to enforce future formatting requirements. BUG=b:192389533 BRANCH=none TEST=run_tests.sh Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I5d93ef61d32d0dab4fe4bf3a77faf3f6693be627 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002839 Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr/zmake/zmake/build_config.py')
-rw-r--r--zephyr/zmake/zmake/build_config.py71
1 files changed, 48 insertions, 23 deletions
diff --git a/zephyr/zmake/zmake/build_config.py b/zephyr/zmake/zmake/build_config.py
index eaa579a777..9a9c7f36a2 100644
--- a/zephyr/zmake/zmake/build_config.py
+++ b/zephyr/zmake/zmake/build_config.py
@@ -13,15 +13,18 @@ class BuildConfig:
A build config is a tuple of environment variables, cmake
variables, kconfig definitons, and kconfig files.
"""
- def __init__(self, environ_defs={}, cmake_defs={}, kconfig_defs={},
- kconfig_files=[]):
+
+ def __init__(
+ self, environ_defs={}, cmake_defs={}, kconfig_defs={}, kconfig_files=[]
+ ):
self.environ_defs = dict(environ_defs)
self.cmake_defs = dict(cmake_defs)
self.kconfig_defs = dict(kconfig_defs)
self.kconfig_files = kconfig_files
- def popen_cmake(self, jobclient, project_dir, build_dir, kconfig_path=None,
- **kwargs):
+ def popen_cmake(
+ self, jobclient, project_dir, build_dir, kconfig_path=None, **kwargs
+ ):
"""Run Cmake with this config using a jobclient.
Args:
@@ -37,39 +40,61 @@ class BuildConfig:
kconfig_files.append(kconfig_path)
elif self.kconfig_defs:
raise ValueError(
- 'Cannot start Cmake on a config with Kconfig items without a '
- 'kconfig_path')
+ "Cannot start Cmake on a config with Kconfig items without a "
+ "kconfig_path"
+ )
if kconfig_files:
- base_config = BuildConfig(environ_defs=self.environ_defs,
- cmake_defs=self.cmake_defs)
+ base_config = BuildConfig(
+ environ_defs=self.environ_defs, cmake_defs=self.cmake_defs
+ )
conf_file_config = BuildConfig(
- cmake_defs={'CONF_FILE': ';'.join(
- str(p.resolve()) for p in kconfig_files)})
+ cmake_defs={
+ "CONF_FILE": ";".join(str(p.resolve()) for p in kconfig_files)
+ }
+ )
return (base_config | conf_file_config).popen_cmake(
- jobclient, project_dir, build_dir, **kwargs)
+ jobclient, project_dir, build_dir, **kwargs
+ )
- kwargs['env'] = dict(**kwargs.get('env', {}), **self.environ_defs)
+ kwargs["env"] = dict(**kwargs.get("env", {}), **self.environ_defs)
return jobclient.popen(
- ['/usr/bin/cmake', '-S', project_dir, '-B', build_dir, '-GNinja',
- *('-D{}={}'.format(*pair) for pair in self.cmake_defs.items())],
- **kwargs)
+ [
+ "/usr/bin/cmake",
+ "-S",
+ project_dir,
+ "-B",
+ build_dir,
+ "-GNinja",
+ *("-D{}={}".format(*pair) for pair in self.cmake_defs.items()),
+ ],
+ **kwargs
+ )
def __or__(self, other):
"""Combine two BuildConfig instances."""
if not isinstance(other, BuildConfig):
- raise TypeError("Unsupported operation | for {} and {}".format(
- type(self), type(other)))
+ raise TypeError(
+ "Unsupported operation | for {} and {}".format(type(self), type(other))
+ )
return BuildConfig(
environ_defs=dict(**self.environ_defs, **other.environ_defs),
cmake_defs=dict(**self.cmake_defs, **other.cmake_defs),
kconfig_defs=dict(**self.kconfig_defs, **other.kconfig_defs),
- kconfig_files=list({*self.kconfig_files, *other.kconfig_files}))
+ kconfig_files=list({*self.kconfig_files, *other.kconfig_files}),
+ )
def __repr__(self):
- return 'BuildConfig({})'.format(', '.join(
- '{}={!r}'.format(name, getattr(self, name))
- for name in ['environ_defs', 'cmake_defs', 'kconfig_defs',
- 'kconfig_files']
- if getattr(self, name)))
+ return "BuildConfig({})".format(
+ ", ".join(
+ "{}={!r}".format(name, getattr(self, name))
+ for name in [
+ "environ_defs",
+ "cmake_defs",
+ "kconfig_defs",
+ "kconfig_files",
+ ]
+ if getattr(self, name)
+ )
+ )