Skip to content

Commit b56a3d9

Browse files
gengjiawentargos
authored andcommitted
tools: update gyp-next to v0.9.3
PR-URL: #39291 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent b168ec2 commit b56a3d9

File tree

14 files changed

+50
-38
lines changed

14 files changed

+50
-38
lines changed

tools/gyp/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
### [0.9.3](https://www.github.com/nodejs/gyp-next/compare/v0.9.2...v0.9.3) (2021-07-07)
4+
5+
6+
### Bug Fixes
7+
8+
* build failure with ninja and Python 3 on Windows ([#113](https://www.github.com/nodejs/gyp-next/issues/113)) ([c172d10](https://www.github.com/nodejs/gyp-next/commit/c172d105deff5db4244e583942215918fa80dd3c))
9+
10+
### [0.9.2](https://www.github.com/nodejs/gyp-next/compare/v0.9.1...v0.9.2) (2021-05-21)
11+
12+
13+
### Bug Fixes
14+
15+
* add support of utf8 encoding ([#105](https://www.github.com/nodejs/gyp-next/issues/105)) ([4d0f93c](https://www.github.com/nodejs/gyp-next/commit/4d0f93c249286d1f0c0f665f5fe7346119f98cf1))
16+
317
### [0.9.1](https://www.github.com/nodejs/gyp-next/compare/v0.9.0...v0.9.1) (2021-05-14)
418

519

tools/gyp/pylib/gyp/MSVSUtil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _SuffixName(name, suffix):
5555
Target name with suffix added (foo_suffix#target)
5656
"""
5757
parts = name.rsplit("#", 1)
58-
parts[0] = "{}_{}".format(parts[0], suffix)
58+
parts[0] = f"{parts[0]}_{suffix}"
5959
return "#".join(parts)
6060

6161

tools/gyp/pylib/gyp/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ def pop(self, last=True): # pylint: disable=W0221
562562
def __repr__(self):
563563
if not self:
564564
return f"{self.__class__.__name__}()"
565-
return "{}({!r})".format(self.__class__.__name__, list(self))
565+
return f"{self.__class__.__name__}({list(self)!r})"
566566

567567
def __eq__(self, other):
568568
if isinstance(other, OrderedSet):

tools/gyp/pylib/gyp/easy_xml.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5+
import sys
56
import re
67
import os
78
import locale
@@ -84,7 +85,7 @@ def _ConstructContentList(xml_parts, specification, pretty, level=0):
8485
rest = specification[1:]
8586
if rest and isinstance(rest[0], dict):
8687
for at, val in sorted(rest[0].items()):
87-
xml_parts.append(' {}="{}"'.format(at, _XmlEscape(val, attr=True)))
88+
xml_parts.append(f' {at}="{_XmlEscape(val, attr=True)}"')
8889
rest = rest[1:]
8990
if rest:
9091
xml_parts.append(">")
@@ -106,7 +107,8 @@ def _ConstructContentList(xml_parts, specification, pretty, level=0):
106107
xml_parts.append("/>%s" % new_line)
107108

108109

109-
def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, win32=False):
110+
def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False,
111+
win32=(sys.platform == "win32")):
110112
""" Writes the XML content to disk, touching the file only if it has changed.
111113
112114
Args:
@@ -121,7 +123,10 @@ def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, win32=False
121123

122124
default_encoding = locale.getdefaultlocale()[1]
123125
if default_encoding and default_encoding.upper() != encoding.upper():
124-
xml_string = xml_string.encode(encoding)
126+
if win32 and sys.version_info < (3, 7):
127+
xml_string = xml_string.decode("cp1251").encode(encoding)
128+
else:
129+
xml_string = xml_string.encode(encoding)
125130

126131
# Get the old content
127132
try:

tools/gyp/pylib/gyp/generator/android.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def WriteActions(self, actions, extra_sources, extra_outputs):
349349
for output in outputs[1:]:
350350
# Make each output depend on the main output, with an empty command
351351
# to force make to notice that the mtime has changed.
352-
self.WriteLn("{}: {} ;".format(self.LocalPathify(output), main_output))
352+
self.WriteLn(f"{self.LocalPathify(output)}: {main_output} ;")
353353

354354
extra_outputs += outputs
355355
self.WriteLn()
@@ -616,7 +616,7 @@ def WriteSources(self, spec, configs, extra_sources):
616616
if IsCPPExtension(ext) and ext != local_cpp_extension:
617617
local_file = root + local_cpp_extension
618618
if local_file != source:
619-
self.WriteLn("{}: {}".format(local_file, self.LocalPathify(source)))
619+
self.WriteLn(f"{local_file}: {self.LocalPathify(source)}")
620620
self.WriteLn("\tmkdir -p $(@D); cp $< $@")
621621
origin_src_dirs.append(os.path.dirname(source))
622622
final_generated_sources.append(local_file)
@@ -908,7 +908,7 @@ def WriteTarget(
908908
if isinstance(v, list):
909909
self.WriteList(v, k)
910910
else:
911-
self.WriteLn("{} := {}".format(k, make.QuoteIfNecessary(v)))
911+
self.WriteLn(f"{k} := {make.QuoteIfNecessary(v)}")
912912
self.WriteLn("")
913913

914914
# Add to the set of targets which represent the gyp 'all' target. We use the

tools/gyp/pylib/gyp/generator/make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2133,7 +2133,7 @@ def WriteSortedXcodeEnv(self, target, env):
21332133
# export foo := a\ b
21342134
# it does not -- the backslash is written to the env as literal character.
21352135
# So don't escape spaces in |env[k]|.
2136-
self.WriteLn("{}: export {} := {}".format(QuoteSpaces(target), k, v))
2136+
self.WriteLn(f"{QuoteSpaces(target)}: export {k} := {v}")
21372137

21382138
def Objectify(self, path):
21392139
"""Convert a path to its output directory form."""

tools/gyp/pylib/gyp/generator/msvs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _ConfigBaseName(config_name, platform_name):
314314

315315
def _ConfigFullName(config_name, config_data):
316316
platform_name = _ConfigPlatform(config_data)
317-
return "{}|{}".format(_ConfigBaseName(config_name, platform_name), platform_name)
317+
return f"{_ConfigBaseName(config_name, platform_name)}|{platform_name}"
318318

319319

320320
def _ConfigWindowsTargetPlatformVersion(config_data, version):
@@ -335,15 +335,15 @@ def _ConfigWindowsTargetPlatformVersion(config_data, version):
335335
# Find a matching entry in sdk_dir\include.
336336
expected_sdk_dir = r"%s\include" % sdk_dir
337337
names = sorted(
338-
[
338+
(
339339
x
340340
for x in (
341341
os.listdir(expected_sdk_dir)
342342
if os.path.isdir(expected_sdk_dir)
343343
else []
344344
)
345345
if x.startswith(version)
346-
],
346+
),
347347
reverse=True,
348348
)
349349
if names:

tools/gyp/pylib/gyp/generator/ninja.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def GenerateDescription(self, verb, message, fallback):
638638
if self.toolset != "target":
639639
verb += "(%s)" % self.toolset
640640
if message:
641-
return "{} {}".format(verb, self.ExpandSpecial(message))
641+
return f"{verb} {self.ExpandSpecial(message)}"
642642
else:
643643
return f"{verb} {self.name}: {fallback}"
644644

@@ -2389,7 +2389,6 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name
23892389
)
23902390
if flavor == "win":
23912391
master_ninja.variable("ld_host", ld_host)
2392-
master_ninja.variable("ldxx_host", ldxx_host)
23932392
else:
23942393
master_ninja.variable(
23952394
"ld_host", CommandWithWrapper("LINK", wrappers, ld_host)

tools/gyp/pylib/gyp/input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check
225225
return data[build_file_path]
226226

227227
if os.path.exists(build_file_path):
228-
build_file_contents = open(build_file_path).read()
228+
build_file_contents = open(build_file_path, encoding='utf-8').read()
229229
else:
230230
raise GypError(f"{build_file_path} not found (cwd: {os.getcwd()})")
231231

tools/gyp/pylib/gyp/msvs_emulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def _TargetConfig(self, config):
333333
# first level is globally for the configuration (this is what we consider
334334
# "the" config at the gyp level, which will be something like 'Debug' or
335335
# 'Release'), VS2015 and later only use this level
336-
if self.vs_version.short_name >= 2015:
336+
if int(self.vs_version.short_name) >= 2015:
337337
return config
338338
# and a second target-specific configuration, which is an
339339
# override for the global one. |config| is remapped here to take into
@@ -537,7 +537,7 @@ def GetCflags(self, config):
537537
)
538538
]
539539
)
540-
if self.vs_version.project_version >= 12.0:
540+
if float(self.vs_version.project_version) >= 12.0:
541541
# New flag introduced in VS2013 (project version 12.0) Forces writes to
542542
# the program database (PDB) to be serialized through MSPDBSRV.EXE.
543543
# https://msdn.microsoft.com/en-us/library/dn502518.aspx

0 commit comments

Comments
 (0)