diff options
| author | Mark Lobodzinski <mark@lunarg.com> | 2016-05-04 09:19:54 -0600 |
|---|---|---|
| committer | Mark Lobodzinski <mark@lunarg.com> | 2016-05-04 09:42:58 -0600 |
| commit | b7a0ab2263b79acfb32ed00f939379b6e4fd3a3a (patch) | |
| tree | f28018007afe7ef4591f1dafaede226039ac4def /determine_vs_version.py | |
| parent | cd0dae62450eda8389948840e366564aee47624c (diff) | |
| download | usermoji-b7a0ab2263b79acfb32ed00f939379b6e4fd3a3a.tar.xz | |
project: Fix tabs, whitespace and line endings
Change-Id: I9cca32a98a1b984b44eca42e4805461c220ae04f
Diffstat (limited to 'determine_vs_version.py')
| -rw-r--r-- | determine_vs_version.py | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/determine_vs_version.py b/determine_vs_version.py index c389ccdf..9dec7223 100644 --- a/determine_vs_version.py +++ b/determine_vs_version.py @@ -40,76 +40,76 @@ def find_executable(program): return exe_file return None - + def determine_year(version): - if version == 8: - return 2005 - elif version == 9: - return 2008 - elif version == 10: - return 2010 - elif version == 11: - return 2012 - elif version == 12: - return 2013 - elif version == 14: - return 2015 - else: - return 0000 - + if version == 8: + return 2005 + elif version == 9: + return 2008 + elif version == 10: + return 2010 + elif version == 11: + return 2012 + elif version == 12: + return 2013 + elif version == 14: + return 2015 + else: + return 0000 + # Determine if msbuild is in the path, then call it to determine the version and parse # it into a format we can use, which is "<version_num> <version_year>". if __name__ == '__main__': - exeName = 'msbuild.exe' - versionCall = exeName + ' /ver' + exeName = 'msbuild.exe' + versionCall = exeName + ' /ver' - # Determine if the executable exists in the path, this is critical. - # - foundExeName = find_executable(exeName) + # Determine if the executable exists in the path, this is critical. + # + foundExeName = find_executable(exeName) - # If not found, return an invalid number but in the appropriate format so it will - # fail if the program above tries to use it. - if foundExeName == None: - print('00 0000') - print('Executable ' + exeName + ' not found in PATH!') - else: - sysCallOut = os.popen(versionCall).read() - - version = None + # If not found, return an invalid number but in the appropriate format so it will + # fail if the program above tries to use it. + if foundExeName == None: + print('00 0000') + print('Executable ' + exeName + ' not found in PATH!') + else: + sysCallOut = os.popen(versionCall).read() + + version = None - # Split around any spaces first - spaceList = sysCallOut.split(' ') - for spaceString in spaceList: + # Split around any spaces first + spaceList = sysCallOut.split(' ') + for spaceString in spaceList: - # If we've already found it, bail. - if version != None: - break - - # Now split around line feeds - lineList = spaceString.split('\n') - for curLine in lineList: + # If we've already found it, bail. + if version != None: + break + + # Now split around line feeds + lineList = spaceString.split('\n') + for curLine in lineList: - # If we've already found it, bail. - if version != None: - break - - # We only want to continue if there's a period in the list - if '.' not in curLine: - continue + # If we've already found it, bail. + if version != None: + break + + # We only want to continue if there's a period in the list + if '.' not in curLine: + continue - # Get the first element and determine if it is a number, if so, we've - # got our number. - splitAroundPeriod = curLine.split('.') - if splitAroundPeriod[0].isdigit(): - version = int (splitAroundPeriod[0]) - break - - # Failsafe to return a number in the proper format, but one that will fail. - if version == None: - version = 00 + # Get the first element and determine if it is a number, if so, we've + # got our number. + splitAroundPeriod = curLine.split('.') + if splitAroundPeriod[0].isdigit(): + version = int (splitAroundPeriod[0]) + break + + # Failsafe to return a number in the proper format, but one that will fail. + if version == None: + version = 00 - # Determine the year associated with that version - year = determine_year(version) + # Determine the year associated with that version + year = determine_year(version) - # Output the string we need for Cmake to properly build for this version - print(str(version) + ' ' + str(year)) + # Output the string we need for Cmake to properly build for this version + print(str(version) + ' ' + str(year)) |
