1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
--- pylib/gyp/msvs_emulation.py.sav 2020-02-19 21:45:13.150161000 +0100
+++ pylib/gyp/msvs_emulation.py 2020-02-21 23:51:56.815937600 +0100
@@ -138,7 +138,7 @@ def _FindDirectXInstallation():
if not dxsdk_dir:
# Setup params to pass to and attempt to launch reg.exe.
cmd = ['reg.exe', 'query', r'HKLM\Software\Microsoft\DirectX', '/s']
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,universal_newlines=True)
for line in p.communicate()[0].splitlines():
if 'InstallPath' in line:
dxsdk_dir = line.split(' ')[3] + "\\"
@@ -321,7 +321,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
@@ -485,7 +485,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 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
@@ -1050,7 +1050,7 @@ def GenerateEnvironmentFiles(toplevel_bu
args = vs.SetupScript(arch)
args.extend(('&&', 'set'))
popen = subprocess.Popen(
- args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True)
variables, _ = popen.communicate()
if popen.returncode != 0:
raise Exception('"%s" failed with error %d' % (args, popen.returncode))
@@ -1071,7 +1071,7 @@ def GenerateEnvironmentFiles(toplevel_bu
args = vs.SetupScript(arch)
args.extend(('&&',
'for', '%i', 'in', '(cl.exe)', 'do', '@echo', 'LOC:%~$PATH:i'))
- popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)
+ popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE,universal_newlines=True)
output, _ = popen.communicate()
cl_paths[arch] = _ExtractCLPath(output)
return cl_paths
--- pylib/gyp/generator/ninja.py.sav 2020-02-19 21:45:13.150161000 +0100
+++ pylib/gyp/generator/ninja.py 2020-02-22 00:42:48.090472000 +0100
@@ -1741,7 +1741,10 @@ def CalculateGeneratorInputInfo(params):
def OpenOutput(path, mode='w'):
"""Open |path| for writing, creating directories if necessary."""
gyp.common.EnsureDirExists(path)
- return open(path, mode)
+ if sys.version_info[0] < 3:
+ return open(path, mode)
+ else:
+ return open(path, mode, encoding="utf-8")
def CommandWithWrapper(cmd, wrappers, prog):
--- pylib/gyp/win_tool.py.sav 2020-02-19 21:45:13.150161000 +0100
+++ pylib/gyp/win_tool.py 2020-03-04 12:46:55.098189500 +0100
@@ -130,7 +130,7 @@ class WinTool(object):
# For that reason, since going through the shell doesn't seem necessary on
# non-Windows don't do that there.
link = subprocess.Popen(args, shell=sys.platform == 'win32', env=env,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True)
out, _ = link.communicate()
for line in out.splitlines():
if (not line.startswith(' Creating library ') and
@@ -197,8 +197,8 @@ class WinTool(object):
# and sometimes doesn't unfortunately.
with open(our_manifest, 'r') as our_f:
with open(assert_manifest, 'r') as assert_f:
- our_data = our_f.read().translate(None, string.whitespace)
- assert_data = assert_f.read().translate(None, string.whitespace)
+ our_data = our_f.read().translate(str.maketrans('','', string.whitespace))
+ assert_data = assert_f.read().translate(str.maketrans('','', string.whitespace))
if our_data != assert_data:
os.unlink(out)
def dump(filename):
@@ -223,7 +223,7 @@ class WinTool(object):
tool)."""
env = self._GetEnv(arch)
popen = subprocess.Popen(args, shell=True, env=env,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True)
out, _ = popen.communicate()
for line in out.splitlines():
if line and 'manifest authoring warning 81010002' not in line:
@@ -255,7 +255,7 @@ class WinTool(object):
idl]
env = self._GetEnv(arch)
popen = subprocess.Popen(args, shell=True, env=env,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True)
out, _ = popen.communicate()
# Filter junk out of stdout, and write filtered versions. Output we want
# to filter is pairs of lines that look like this:
@@ -274,7 +274,7 @@ class WinTool(object):
"""Filter logo banner from invocations of asm.exe."""
env = self._GetEnv(arch)
popen = subprocess.Popen(args, shell=True, env=env,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True)
out, _ = popen.communicate()
for line in out.splitlines():
if (not line.startswith('Copyright (C) Microsoft Corporation') and
@@ -289,7 +289,7 @@ class WinTool(object):
don't support the /nologo flag."""
env = self._GetEnv(arch)
popen = subprocess.Popen(args, shell=True, env=env,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,universal_newlines=True)
out, _ = popen.communicate()
for line in out.splitlines():
if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and
|