Fix CHANGES file version parsing. -dev is optional

This commit is contained in:
David Neto 2016-06-02 15:32:28 -04:00
parent 812fb7d798
commit 87125a19c6

View File

@ -54,14 +54,14 @@ def command_output(cmd, dir):
return stdout
def deduceSoftwareVersion(dir):
def deduce_software_version(dir):
"""Returns a software version number parsed from the CHANGES file
in the given dir.
The CHANGES file describes most recent versions first.
"""
pattern = re.compile('(v\d+\.\d+(-dev)) \d\d\d\d-\d\d-\d\d$')
pattern = re.compile('(v\d+\.\d+(-dev)?) \d\d\d\d-\d\d-\d\d$')
changes_file = os.path.join(dir, 'CHANGES')
with open(changes_file) as f:
for line in f.readlines():
@ -99,7 +99,7 @@ def main():
output_file = sys.argv[2]
software_version = deduceSoftwareVersion(sys.argv[1])
software_version = deduce_software_version(sys.argv[1])
new_content = '"{}", "SPIRV-Tools {} {}"\n'.format(
software_version, software_version,
describe(sys.argv[1]).replace('"', '\\"'))