From c172d105deff5db4244e583942215918fa80dd3c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 7 Jul 2021 10:40:04 +0900 Subject: [PATCH] fix: build failure with ninja and Python 3 on Windows (#113) --- pylib/gyp/generator/ninja.py | 1 - pylib/gyp/msvs_emulation.py | 4 ++-- pylib/gyp/win_tool.py | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py index 58162437..b66e674a 100644 --- a/pylib/gyp/generator/ninja.py +++ b/pylib/gyp/generator/ninja.py @@ -2389,7 +2389,6 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name ) if flavor == "win": master_ninja.variable("ld_host", ld_host) - master_ninja.variable("ldxx_host", ldxx_host) else: master_ninja.variable( "ld_host", CommandWithWrapper("LINK", wrappers, ld_host) diff --git a/pylib/gyp/msvs_emulation.py b/pylib/gyp/msvs_emulation.py index f744e38d..6fcabd04 100644 --- a/pylib/gyp/msvs_emulation.py +++ b/pylib/gyp/msvs_emulation.py @@ -333,7 +333,7 @@ def _TargetConfig(self, config): # 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 @@ -537,7 +537,7 @@ def GetCflags(self, config): ) ] ) - if self.vs_version.project_version >= 12.0: + if float(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 diff --git a/pylib/gyp/win_tool.py b/pylib/gyp/win_tool.py index 4dbcda50..638eee40 100755 --- a/pylib/gyp/win_tool.py +++ b/pylib/gyp/win_tool.py @@ -221,8 +221,9 @@ def ExecLinkWithManifests( # and sometimes doesn't unfortunately. with open(our_manifest) as our_f: with open(assert_manifest) as assert_f: - our_data = our_f.read().translate(None, string.whitespace) - assert_data = assert_f.read().translate(None, string.whitespace) + translator = str.maketrans('', '', string.whitespace) + our_data = our_f.read().translate(translator) + assert_data = assert_f.read().translate(translator) if our_data != assert_data: os.unlink(out)