summaryrefslogtreecommitdiff
path: root/zephyr/zmake/zmake/version.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/version.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/version.py')
-rw-r--r--zephyr/zmake/zmake/version.py44
1 files changed, 26 insertions, 18 deletions
diff --git a/zephyr/zmake/zmake/version.py b/zephyr/zmake/zmake/version.py
index cddce86ca5..d026c07c2f 100644
--- a/zephyr/zmake/zmake/version.py
+++ b/zephyr/zmake/zmake/version.py
@@ -21,12 +21,15 @@ def _get_num_commits(repo):
An integer, the number of commits that have been made.
"""
try:
- result = subprocess.run(['git', '-C', repo, 'rev-list', 'HEAD',
- '--count'],
- check=True, stdout=subprocess.PIPE,
- stderr=subprocess.DEVNULL, encoding='utf-8')
+ result = subprocess.run(
+ ["git", "-C", repo, "rev-list", "HEAD", "--count"],
+ check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL,
+ encoding="utf-8",
+ )
except subprocess.CalledProcessError:
- commits = '9999'
+ commits = "9999"
else:
commits = result.stdout
@@ -47,17 +50,20 @@ def _get_revision(repo):
A string, of the current revision.
"""
try:
- result = subprocess.run(['git', '-C', repo, 'log', '-n1',
- '--format=%H'],
- check=True, stdout=subprocess.PIPE,
- stderr=subprocess.DEVNULL, encoding='utf-8')
+ result = subprocess.run(
+ ["git", "-C", repo, "log", "-n1", "--format=%H"],
+ check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.DEVNULL,
+ encoding="utf-8",
+ )
except subprocess.CalledProcessError:
# Fall back to the VCSID provided by the packaging system.
# Format is 0.0.1-r425-032666c418782c14fe912ba6d9f98ffdf0b941e9 for
# releases and 9999-032666c418782c14fe912ba6d9f98ffdf0b941e9 for
# 9999 ebuilds.
- vcsid = os.environ.get('VCSID', '9999-unknown')
- revision = vcsid.rsplit('-', 1)[1]
+ vcsid = os.environ.get("VCSID", "9999-unknown")
+ revision = vcsid.rsplit("-", 1)[1]
else:
revision = result.stdout
@@ -84,19 +90,21 @@ def get_version_string(project, zephyr_base, modules, static=False):
num_commits = 0
if static:
- vcs_hashes = 'STATIC'
+ vcs_hashes = "STATIC"
else:
repos = {
- 'os': zephyr_base,
+ "os": zephyr_base,
**modules,
}
for repo in repos.values():
num_commits += _get_num_commits(repo)
- vcs_hashes = ','.join(
- '{}:{}'.format(name, _get_revision(repo)[:6])
- for name, repo in sorted(repos.items()))
+ vcs_hashes = ",".join(
+ "{}:{}".format(name, _get_revision(repo)[:6])
+ for name, repo in sorted(repos.items())
+ )
- return '{}_v{}.{}.{}-{}'.format(
- project_id, major_version, minor_version, num_commits, vcs_hashes)
+ return "{}_v{}.{}.{}-{}".format(
+ project_id, major_version, minor_version, num_commits, vcs_hashes
+ )