summaryrefslogtreecommitdiff
path: root/zephyr/zmake/zmake/version.py
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/zmake/zmake/version.py')
-rw-r--r--zephyr/zmake/zmake/version.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/zephyr/zmake/zmake/version.py b/zephyr/zmake/zmake/version.py
index 5ac060f23b..ee857db209 100644
--- a/zephyr/zmake/zmake/version.py
+++ b/zephyr/zmake/zmake/version.py
@@ -1,4 +1,4 @@
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -80,7 +80,7 @@ def get_version_string(project, zephyr_base, modules, static=False):
"""Get the version string associated with a build.
Args:
- project: a zmake.project.Project object
+ project: a string project name
zephyr_base: the path to the zephyr directory
modules: a dictionary mapping module names to module paths
static: if set, create a version string not dependent on git
@@ -117,7 +117,7 @@ def get_version_string(project, zephyr_base, modules, static=False):
)
return "{}_v{}.{}.{}-{}".format(
- project.config.project_name,
+ project,
major_version,
minor_version,
num_commits,
@@ -125,7 +125,7 @@ def get_version_string(project, zephyr_base, modules, static=False):
)
-def write_version_header(version_str, output_path, static=False):
+def write_version_header(version_str, output_path, tool, static=False):
"""Generate a version header and write it to the specified path.
Generate a version header in the format expected by the EC build
@@ -139,12 +139,15 @@ def write_version_header(version_str, output_path, static=False):
as one generated by get_version_string.
output_path: The file path to write at (a pathlib.Path
object).
+ tool: Name of the tool that is invoking this function ("zmake",
+ "generate_ec_version.py", etc). Included in a comment in the
+ header.
static: If true, generate a header which does not include
information like the username, hostname, or date, allowing
the build to be reproducible.
"""
output = io.StringIO()
- output.write("/* This file is automatically generated by zmake */\n")
+ output.write(f"/* This file is automatically generated by {tool} */\n")
def add_def(name, value):
output.write("#define {} {}\n".format(name, util.c_str(value)))