Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5f1d792

Browse filesBrowse files
ryzokukendanielleadams
authored andcommitted
tools: update gyp to v0.5.0
PR-URL: #32698 Reviewed-By: Christian Clauss <cclauss@me.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent ad8fce6 commit 5f1d792
Copy full SHA for 5f1d792

File tree

Expand file treeCollapse file tree

19 files changed

+144
-232
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

19 files changed

+144
-232
lines changed
Open diff view settings
Collapse file

‎tools/gyp/.flake8‎

Copy file name to clipboard
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[flake8]
2-
max-complexity = 10
2+
max-complexity = 101
33
max-line-length = 88
4-
extend-ignore = E203,C901,E501
4+
extend-ignore = E203 # whitespace before ':' to agree with psf/black
Collapse file

‎tools/gyp/.github/workflows/Python_tests.yml‎

Copy file name to clipboardExpand all lines: tools/gyp/.github/workflows/Python_tests.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
max-parallel: 15
1313
matrix:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
15-
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
15+
python-version: [2.7, 3.6, 3.7, 3.8, 3.9.0-rc.1] # 3.5,
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
Collapse file

‎tools/gyp/CHANGELOG.md‎

Copy file name to clipboardExpand all lines: tools/gyp/CHANGELOG.md
+14-1Lines changed: 14 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77
## [Unreleased]
88

9+
## [0.5.0] - 2020-09-30
10+
11+
### Added
12+
- Extended compile_commands_json generator to consider more file extensions than
13+
just `c` and `cc`. `cpp` and `cxx` are now supported.
14+
- Source files with duplicate basenames are now supported.
15+
16+
### Removed
17+
- The `--no-duplicate-basename-check` option was removed.
18+
- The `msvs_enable_marmasm` configuration option was removed in favor of
19+
auto-inclusion of the "marmasm" sections for Windows on ARM.
20+
921
## [0.4.0] - 2020-07-14
1022

1123
### Added
@@ -34,7 +46,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
3446
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
3547
with changes made over the years in Node.js and node-gyp.
3648

37-
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
49+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.5.0...HEAD
50+
[0.5.0]: https://github.com/nodejs/gyp-next/compare/v0.4.0...v0.5.0
3851
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
3952
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
4053
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
Collapse file

‎tools/gyp/README.md‎

Copy file name to clipboardExpand all lines: tools/gyp/README.md
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ GYP can Generate Your Projects.
22
===================================
33

44
Documents are available at [gyp.gsrc.io](https://gyp.gsrc.io), or you can check out ```md-pages``` branch to read those documents offline.
5+
6+
__gyp-next__ is [released](https://github.com/nodejs/gyp-next/releases) to the [__Python Packaging Index__](https://pypi.org/project/gyp-next) (PyPI) and can be installed with the command:
7+
* `python3 -m pip install gyp-next`
Collapse file

‎tools/gyp/pylib/gyp/MSVSSettings_test.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/MSVSSettings_test.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ def testConvertToMSBuildSettings_warnings(self):
678678
"MSBuild, index value (21) not in expected range [0, 3)",
679679
"Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to "
680680
"MSBuild, index value (13) not in expected range [0, 3)",
681-
"Warning: while converting VCCLCompilerTool/GeneratePreprocessedFile to "
681+
"Warning: while converting "
682+
"VCCLCompilerTool/GeneratePreprocessedFile to "
682683
"MSBuild, value must be one of [0, 1, 2]; got 14",
683684
"Warning: while converting VCLinkerTool/Driver to "
684685
"MSBuild, index value (10) not in expected range [0, 4)",
@@ -1348,7 +1349,8 @@ def testConvertToMSBuildSettings_actual(self):
13481349
"EmbedManifest": "false",
13491350
"GenerateCatalogFiles": "true",
13501351
"InputResourceManifests": "asfsfdafs",
1351-
"ManifestResourceFile": "$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf",
1352+
"ManifestResourceFile":
1353+
"$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf",
13521354
"OutputManifestFile": "$(TargetPath).manifestdfs",
13531355
"RegistrarScriptFile": "sdfsfd",
13541356
"ReplacementsFile": "sdffsd",
@@ -1532,7 +1534,8 @@ def testConvertToMSBuildSettings_actual(self):
15321534
"LinkIncremental": "",
15331535
},
15341536
"ManifestResourceCompile": {
1535-
"ResourceOutputFileName": "$(IntDir)$(TargetFileName).embed.manifest.resfdsf"
1537+
"ResourceOutputFileName":
1538+
"$(IntDir)$(TargetFileName).embed.manifest.resfdsf"
15361539
},
15371540
}
15381541
self.maxDiff = 9999 # on failure display a long diff
Collapse file

‎tools/gyp/pylib/gyp/__init__.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/__init__.py
-17Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def Load(
6868
params=None,
6969
check=False,
7070
circular_check=True,
71-
duplicate_basename_check=True,
7271
):
7372
"""
7473
Loads one or more specified build files.
@@ -156,7 +155,6 @@ def Load(
156155
generator_input_info,
157156
check,
158157
circular_check,
159-
duplicate_basename_check,
160158
params["parallel"],
161159
params["root_targets"],
162160
)
@@ -431,20 +429,6 @@ def gyp_main(args):
431429
regenerate=False,
432430
help="don't check for circular relationships between files",
433431
)
434-
# --no-duplicate-basename-check disables the check for duplicate basenames
435-
# in a static_library/shared_library project. Visual C++ 2008 generator
436-
# doesn't support this configuration. Libtool on Mac also generates warnings
437-
# when duplicate basenames are passed into Make generator on Mac.
438-
# TODO(yukawa): Remove this option when these legacy generators are
439-
# deprecated.
440-
parser.add_argument(
441-
"--no-duplicate-basename-check",
442-
dest="duplicate_basename_check",
443-
action="store_false",
444-
default=True,
445-
regenerate=False,
446-
help="don't check for duplicate basenames",
447-
)
448432
parser.add_argument(
449433
"--no-parallel",
450434
action="store_true",
@@ -651,7 +635,6 @@ def gyp_main(args):
651635
params,
652636
options.check,
653637
options.circular_check,
654-
options.duplicate_basename_check,
655638
)
656639

657640
# TODO(mark): Pass |data| for now because the generator needs a list of
Collapse file

‎tools/gyp/pylib/gyp/common.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/common.py
+15-9Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,14 @@ class Writer(object):
352352
"""Wrapper around file which only covers the target if it differs."""
353353

354354
def __init__(self):
355-
# On Cygwin remove the "dir" argument because `C:` prefixed paths are treated as relative,
356-
# consequently ending up with current dir "/cygdrive/c/..." being prefixed to those, which was
357-
# obviously a non-existent path, for example: "/cygdrive/c/<some folder>/C:\<my win style abs path>".
358-
# See https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp for more details
355+
# On Cygwin remove the "dir" argument
356+
# `C:` prefixed paths are treated as relative,
357+
# consequently ending up with current dir "/cygdrive/c/..."
358+
# being prefixed to those, which was
359+
# obviously a non-existent path,
360+
# for example: "/cygdrive/c/<some folder>/C:\<my win style abs path>".
361+
# For more details see:
362+
# https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp
359363
base_temp_dir = "" if IsCygwin() else os.path.dirname(filename)
360364
# Pick temporary file.
361365
tmp_fd, self.tmp_path = tempfile.mkstemp(
@@ -391,13 +395,15 @@ def close(self):
391395
# one.
392396
os.unlink(self.tmp_path)
393397
else:
394-
# The new file is different from the old one, or there is no old one.
398+
# The new file is different from the old one,
399+
# or there is no old one.
395400
# Rename the new file to the permanent name.
396401
#
397402
# tempfile.mkstemp uses an overly restrictive mode, resulting in a
398403
# file that can only be read by the owner, regardless of the umask.
399-
# There's no reason to not respect the umask here, which means that
400-
# an extra hoop is required to fetch it and reset the new file's mode.
404+
# There's no reason to not respect the umask here,
405+
# which means that an extra hoop is required
406+
# to fetch it and reset the new file's mode.
401407
#
402408
# No way to get the umask without setting a new one? Set a safe one
403409
# and then set it back to the old value.
@@ -406,8 +412,8 @@ def close(self):
406412
os.chmod(self.tmp_path, 0o666 & ~umask)
407413
if sys.platform == "win32" and os.path.exists(filename):
408414
# NOTE: on windows (but not cygwin) rename will not replace an
409-
# existing file, so it must be preceded with a remove. Sadly there
410-
# is no way to make the switch atomic.
415+
# existing file, so it must be preceded with a remove.
416+
# Sadly there is no way to make the switch atomic.
411417
os.remove(filename)
412418
os.rename(self.tmp_path, filename)
413419
except Exception:
Collapse file

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

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/android.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def WriteSources(self, spec, configs, extra_sources):
557557
These are source files necessary to build the current target.
558558
We need to handle shared_intermediate directory source files as
559559
a special case by copying them to the intermediate directory and
560-
treating them as a genereated sources. Otherwise the Android build
560+
treating them as a generated sources. Otherwise the Android build
561561
rules won't pick them up.
562562
563563
Args:
Collapse file

‎tools/gyp/pylib/gyp/generator/compile_commands_json.py‎

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/compile_commands_json.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def AddCommandsForTarget(cwd, target, params, per_config_commands):
6161
defines = ["-D" + s for s in defines]
6262

6363
# TODO(bnoordhuis) Handle generated source files.
64-
sources = target.get("sources", [])
65-
sources = [s for s in sources if s.endswith(".c") or s.endswith(".cc")]
64+
extensions = (".c", ".cc", ".cpp", ".cxx")
65+
sources = [s for s in target.get("sources", []) if s.endswith(extensions)]
6666

6767
def resolve(filename):
6868
return os.path.abspath(os.path.join(cwd, filename))
Collapse file

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

Copy file name to clipboardExpand all lines: tools/gyp/pylib/gyp/generator/make.py
+14-54Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import gyp.common
3131
import gyp.xcode_emulation
3232
from gyp.common import GetEnvironFallback
33-
from gyp.common import GypError
3433

3534
import hashlib
3635

@@ -177,7 +176,7 @@ def CalculateGeneratorInputInfo(params):
177176
178177
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
179178
cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
180-
"""
179+
""" # noqa: E501
181180

182181
LINK_COMMANDS_MAC = """\
183182
quiet_cmd_alink = LIBTOOL-STATIC $@
@@ -191,7 +190,7 @@ def CalculateGeneratorInputInfo(params):
191190
192191
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
193192
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
194-
"""
193+
""" # noqa: E501
195194

196195
LINK_COMMANDS_ANDROID = """\
197196
quiet_cmd_alink = AR($(TOOLSET)) $@
@@ -218,7 +217,7 @@ def CalculateGeneratorInputInfo(params):
218217
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS)
219218
quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@
220219
cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
221-
"""
220+
""" # noqa: E501
222221

223222

224223
LINK_COMMANDS_AIX = """\
@@ -236,7 +235,7 @@ def CalculateGeneratorInputInfo(params):
236235
237236
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
238237
cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
239-
"""
238+
""" # noqa: E501
240239

241240

242241
LINK_COMMANDS_OS390 = """\
@@ -254,8 +253,7 @@ def CalculateGeneratorInputInfo(params):
254253
255254
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
256255
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL
257-
258-
"""
256+
""" # noqa: E501
259257

260258

261259
# Header of toplevel Makefile.
@@ -404,7 +402,7 @@ def CalculateGeneratorInputInfo(params):
404402
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@")
405403
406404
%(link_commands)s
407-
"""
405+
""" # noqa: E501
408406
r"""
409407
# Define an escape_quotes function to escape single quotes.
410408
# This allows us to handle quotes properly as long as we always use
@@ -503,7 +501,7 @@ def CalculateGeneratorInputInfo(params):
503501
.PHONY: FORCE_DO_CMD
504502
FORCE_DO_CMD:
505503
506-
"""
504+
""" # noqa: E501
507505
)
508506

509507
SHARED_HEADER_MAC_COMMANDS = """
@@ -534,7 +532,7 @@ def CalculateGeneratorInputInfo(params):
534532
535533
quiet_cmd_infoplist = INFOPLIST $@
536534
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
537-
"""
535+
""" # noqa: E501
538536

539537

540538
def WriteRootHeaderSuffixRules(writer):
@@ -672,43 +670,6 @@ def SourceifyAndQuoteSpaces(path):
672670
return QuoteSpaces(Sourceify(path))
673671

674672

675-
# TODO: Avoid code duplication with _ValidateSourcesForMSVSProject in msvs.py.
676-
def _ValidateSourcesForOSX(spec, all_sources):
677-
"""Makes sure if duplicate basenames are not specified in the source list.
678-
679-
Arguments:
680-
spec: The target dictionary containing the properties of the target.
681-
"""
682-
if spec.get("type", None) != "static_library":
683-
return
684-
685-
basenames = {}
686-
for source in all_sources:
687-
name, ext = os.path.splitext(source)
688-
is_compiled_file = ext in [".c", ".cc", ".cpp", ".cxx", ".m", ".mm", ".s", ".S"]
689-
if not is_compiled_file:
690-
continue
691-
basename = os.path.basename(name) # Don't include extension.
692-
basenames.setdefault(basename, []).append(source)
693-
694-
error = ""
695-
for basename, files in basenames.items():
696-
if len(files) > 1:
697-
error += " %s: %s\n" % (basename, " ".join(files))
698-
699-
if error:
700-
print(
701-
(
702-
"static library %s has several files with the same basename:\n"
703-
% spec["target_name"]
704-
)
705-
+ error
706-
+ "libtool on OS X will generate"
707-
+ " warnings for them."
708-
)
709-
raise GypError("Duplicate basenames in sources section, see list above")
710-
711-
712673
# Map from qualified target to path to output.
713674
target_outputs = {}
714675
# Map from qualified target to any linkable output. A subset
@@ -867,10 +828,6 @@ def Write(
867828
# Sources.
868829
all_sources = spec.get("sources", []) + extra_sources
869830
if all_sources:
870-
if self.flavor == "mac":
871-
# libtool on OS X generates warnings for duplicate basenames in the same
872-
# target.
873-
_ValidateSourcesForOSX(spec, all_sources)
874831
self.WriteSources(
875832
configs,
876833
deps,
@@ -1342,7 +1299,10 @@ def WriteSources(
13421299
)
13431300

13441301
if self.flavor == "mac":
1345-
cflags = self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
1302+
cflags = self.xcode_settings.GetCflags(
1303+
configname,
1304+
arch=config.get('xcode_configuration_platform')
1305+
)
13461306
cflags_c = self.xcode_settings.GetCflagsC(configname)
13471307
cflags_cc = self.xcode_settings.GetCflagsCC(configname)
13481308
cflags_objc = self.xcode_settings.GetCflagsObjC(configname)
@@ -1659,8 +1619,8 @@ def WriteTarget(
16591619
ldflags = config.get("ldflags", [])
16601620
# Compute an rpath for this output if needed.
16611621
if any(dep.endswith(".so") or ".so." in dep for dep in deps):
1662-
# We want to get the literal string "$ORIGIN" into the link command,
1663-
# so we need lots of escaping.
1622+
# We want to get the literal string "$ORIGIN"
1623+
# into the link command, so we need lots of escaping.
16641624
ldflags.append(r"-Wl,-rpath=\$$ORIGIN/lib.%s/" % self.toolset)
16651625
ldflags.append(
16661626
r"-Wl,-rpath-link=\$(builddir)/lib.%s/" % self.toolset

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.