msvs_emulation.py: avoid string-int/float comparisons
This silently does a wrong thing on python2 (compares *type names*
instead of values, see "Objects of different types" note on
https://docs.python.org/2/library/stdtypes.html#comparisons), and throws
TypeError on python3.
@@ -28,6 +28,10 @@ except NameError:
windows_quoter_regex = re.compile(r'(\\*)"')
+def version_to_tuple(version_str):
+ return tuple(int(x) for x in version_str.split('.'))
+
+
def QuoteForRspFile(arg):
"""Quote a command line argument so that it appears as one argument when
processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for
@@ -324,7 +328,7 @@ class MsvsSettings(object):
# first level is globally for the configuration (this is what we consider
# "the" config at the gyp level, which will be something like 'Debug' or
# 'Release'), VS2015 and later only use this level
- if self.vs_version.short_name >= 2015:
+ if int(self.vs_version.short_name) >= 2015:
return config
# and a second target-specific configuration, which is an
# override for the global one. |config| is remapped here to take into
@@ -488,7 +492,7 @@ class MsvsSettings(object):
prefix='/arch:')
cflags.extend(['/FI' + f for f in self._Setting(
('VCCLCompilerTool', 'ForcedIncludeFiles'), config, default=[])])
- if self.vs_version.project_version >= 12.0:
+ if version_to_tuple(self.vs_version.project_version) >= (12, 0):
# New flag introduced in VS2013 (project version 12.0) Forces writes to
# the program database (PDB) to be serialized through MSPDBSRV.EXE.
# https://msdn.microsoft.com/en-us/library/dn502518.aspx
