Index: tools/push-to-trunk/generate_version.py |
diff --git a/tools/push-to-trunk/generate_version.py b/tools/push-to-trunk/generate_version.py |
index b4a0221eae5c10224a18d79bf8067ca3df958177..4f0ba501783fc87dcdc21b32f2b746d3a5f2b106 100755 |
--- a/tools/push-to-trunk/generate_version.py |
+++ b/tools/push-to-trunk/generate_version.py |
@@ -19,6 +19,12 @@ CWD = os.path.abspath( |
VERSION_CC = os.path.join(CWD, "src", "version.cc") |
def main(): |
+ if len(sys.argv) != 2: |
+ print "Error: Specify the output file path for version.cc" |
+ return 1 |
+ version_out = sys.argv[1] |
+ assert os.path.exists(os.path.dirname(version_out)) |
+ |
tag = subprocess.check_output( |
"git describe --tags", |
shell=True, |
@@ -63,7 +69,7 @@ def main(): |
if line.startswith("#define %s" % definition): |
line = re.sub("\d+$", substitute, line) |
output.append(line) |
- with open(VERSION_CC, "w") as f: |
+ with open(version_out, "w") as f: |
f.write("\n".join(output)) |
# Log what was done. |