Chromium Code Reviews| Index: runtime/tools/make_version.py |
| =================================================================== |
| --- runtime/tools/make_version.py (revision 13769) |
| +++ runtime/tools/make_version.py (working copy) |
| @@ -13,6 +13,14 @@ |
| import time |
| from optparse import OptionParser |
| +def getVersion(): |
|
Ivan Posva
2012/10/19 08:42:14
Where is this used?
ricow1
2012/10/19 08:49:54
Removed, this was leftover from me hacking on usin
|
| + proc = subprocess.Popen(['awk', |
| + '$1 == "%s" {print $2}' % (part), |
| + version_file], |
| + stdout=subprocess.PIPE, |
| + stderr=subprocess.STDOUT) |
| + return proc.communicate()[0].split('\n')[0] |
| + |
| def getVersionPart(version_file, part): |
| proc = subprocess.Popen(['awk', |
|
Ivan Posva
2012/10/19 08:42:14
How about adding debug output here as well?
ricow1
2012/10/19 08:49:54
Done.
|
| '$1 == "%s" {print $2}' % (part), |
| @@ -22,15 +30,21 @@ |
| return proc.communicate()[0].split('\n')[0] |
| def getRevision(): |
| + print "Getting revision" |
| is_svn = True |
| if os.path.exists('.svn'): |
| + print "Using svn to get revision" |
| cmd = ['svn', 'info'] |
| else: |
| + print "Using git svn to get revision" |
| cmd = ['git', 'svn', 'info'] |
| try: |
| + print "Running command to get revision: %s" % cmd |
| proc = subprocess.Popen(cmd, |
| stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| - return proc.communicate()[0].split('\n')[4].split(' ')[1] |
| + revision = proc.communicate()[0].split('\n')[4].split(' ')[1] |
| + print "Got revision: %s" % revision |
| + return revision |
| except Exception: |
| # If we can't get any revision info (due to lack of tooling) return ''. |
| return '' |
| @@ -46,14 +60,26 @@ |
| patch = getVersionPart(version_file, 'PATCH') |
| revision = getRevision() |
| user = getpass.getuser() |
| - return '%s.%s.%s.%s_%s_%s' % (major, minor, build, patch, revision, user) |
| + version_string = '%s.%s.%s.%s_%s_%s' % (major, |
| + minor, |
| + build, |
| + patch, |
| + revision, |
| + user) |
| + print "Returning version string: %s " % version_string |
| + return version_string |
| def makeFile(output_file, input_file, version_file): |
| + print "Making version file" |
| version_cc_text = open(input_file).read() |
| + version_string = makeVersionString(version_file) |
| + print "Writing version to version_cc file: %s" % version_string |
| version_cc_text = version_cc_text.replace("{{VERSION_STR}}", |
| - makeVersionString(version_file)) |
| + version_string) |
| + version_time = time.ctime(time.time()) |
| + print "Writing time to version_cc file: %s" % version_time |
| version_cc_text = version_cc_text.replace("{{BUILD_TIME}}", |
| - time.ctime(time.time())) |
| + version_time) |
| open(output_file, 'w').write(version_cc_text) |
| return True |