Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: tools/push-to-trunk/generate_version.py

Issue 850263002: Revert of Auto-generate v8 version based on tags. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gyp/v8.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 28cd2033c935b397eb1b2b917aa54000ed057b22..b4a0221eae5c10224a18d79bf8067ca3df958177 100755
--- a/tools/push-to-trunk/generate_version.py
+++ b/tools/push-to-trunk/generate_version.py
@@ -19,12 +19,6 @@
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,
@@ -56,20 +50,21 @@
patch = "0"
# Modify version.cc with the new values.
+ with open(VERSION_CC, "r") as f:
+ text = f.read()
output = []
- with open(VERSION_CC, "r") as f:
- for line in f:
- for definition, substitute in (
- ("MAJOR_VERSION", major),
- ("MINOR_VERSION", minor),
- ("BUILD_NUMBER", build),
- ("PATCH_LEVEL", patch),
- ("IS_CANDIDATE_VERSION", candidate)):
- if line.startswith("#define %s" % definition):
- line = re.sub("\d+$", substitute, line)
- output.append(line)
- with open(version_out, "w") as f:
- f.write("".join(output))
+ for line in text.split("\n"):
+ for definition, substitute in (
+ ("MAJOR_VERSION", major),
+ ("MINOR_VERSION", minor),
+ ("BUILD_NUMBER", build),
+ ("PATCH_LEVEL", patch),
+ ("IS_CANDIDATE_VERSION", candidate)):
+ if line.startswith("#define %s" % definition):
+ line = re.sub("\d+$", substitute, line)
+ output.append(line)
+ with open(VERSION_CC, "w") as f:
+ f.write("\n".join(output))
# Log what was done.
candidate_txt = " (candidate)" if candidate == "1" else ""
« no previous file with comments | « tools/gyp/v8.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698