| Index: runtime/tools/make_version.py
|
| ===================================================================
|
| --- runtime/tools/make_version.py (revision 13811)
|
| +++ runtime/tools/make_version.py (working copy)
|
| @@ -14,23 +14,31 @@
|
| from optparse import OptionParser
|
|
|
| def getVersionPart(version_file, part):
|
| - proc = subprocess.Popen(['awk',
|
| - '$1 == "%s" {print $2}' % (part),
|
| - version_file],
|
| + command = ['awk', '$1 == "%s" {print $2}' % (part), version_file]
|
| + print "Getting version part: %s Running command %s" % (part, command)
|
| + proc = subprocess.Popen(command,
|
| stdout=subprocess.PIPE,
|
| stderr=subprocess.STDOUT)
|
| - return proc.communicate()[0].split('\n')[0]
|
| + result = proc.communicate()[0].split('\n')[0]
|
| + print "Got result: %s" % result
|
| + return result
|
|
|
| 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 +54,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
|
|
|
|
|