Skip to content

Commit

Permalink
tools: update gyp-next to 0.18.2
Browse files Browse the repository at this point in the history
PR-URL: #55160
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information
nodejs-github-bot authored and aduh95 committed Oct 9, 2024
1 parent 77f8a3f commit 6a7d201
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 126 deletions.
8 changes: 8 additions & 0 deletions tools/gyp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [0.18.2](https://github.com/nodejs/gyp-next/compare/v0.18.1...v0.18.2) (2024-09-23)


### Bug Fixes

* do not assume that /usr/bin/env exists on macOS ([#216](https://github.com/nodejs/gyp-next/issues/216)) ([706d04a](https://github.com/nodejs/gyp-next/commit/706d04aba5bd18f311dc56f84720e99f64c73466))
* fix E721 lint errors ([#206](https://github.com/nodejs/gyp-next/issues/206)) ([d1299a4](https://github.com/nodejs/gyp-next/commit/d1299a49d313eccabecf97ccb56fc033afad39ad))

## [0.18.1](https://github.com/nodejs/gyp-next/compare/v0.18.0...v0.18.1) (2024-05-26)


Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/docs/Hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See [Testing](Testing.md) for more details on the test framework.
Note that it can be handy to look at the project files output by the tests
to diagnose problems. The easiest way to do that is by kindly asking the
test driver to leave the temporary directories it creates in-place.
This is done by setting the enviroment variable "PRESERVE", e.g.
This is done by setting the environment variable "PRESERVE", e.g.

```
set PRESERVE=all # On Windows
Expand Down
6 changes: 3 additions & 3 deletions tools/gyp/docs/LanguageSpecification.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ have structural meaning for target definitions:
| `all_dependent_settings` | A dictionary of settings to be applied to all dependents of the target, transitively. This includes direct dependents and the entire set of their dependents, and so on. This section may contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections. Compare `direct_dependent_settings` and `link_settings`. |
| `configurations` | A list of dictionaries defining build configurations for the target. See the "Configurations" section below. |
| `copies` | A list of copy actions to perform. See the "Copies" section below. |
| `defines` | A list of preprocesor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
| `defines` | A list of preprocessor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
| `dependencies` | A list of targets on which this target depends. Targets in other `.gyp` files are specified as `../path/to/other.gyp:target_we_want`. |
| `direct_dependent_settings` | A dictionary of settings to be applied to other targets that depend on this target. These settings will only be applied to direct dependents. This section may contain anything found within a `target` dictionary, except `configurations`, `target_name`, and `type` sections. Compare with `all_dependent_settings` and `link_settings`. |
| `include_dirs` | A list of include directories to be passed on the command line to the C/C++ compiler (via `-I` or `/I` options). |
Expand Down Expand Up @@ -208,8 +208,8 @@ Configuration dictionaries may also contain these elements:

Conditionals may appear within any dictionary in a `.gyp` file. There
are two tpes of conditionals, which differ only in the timing of their
processing. `conditons` sections are processed shortly after loading
`.gyp` files, and `target_conditons` sections are processed after all
processing. `conditions` sections are processed shortly after loading
`.gyp` files, and `target_conditions` sections are processed after all
dependencies have been computed.

A conditional section is introduced with a `conditions` or
Expand Down
6 changes: 3 additions & 3 deletions tools/gyp/docs/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,15 @@ fails the test if it does.

Verifies that the output string contains all of the "lines" in the specified
list of lines. In practice, the lines can be any substring and need not be
`\n`-terminaed lines per se. If any line is missing, the test fails.
`\n`-terminated lines per se. If any line is missing, the test fails.

```
test.must_not_contain_any_lines(output, lines)
```

Verifies that the output string does _not_ contain any of the "lines" in the
specified list of lines. In practice, the lines can be any substring and need
not be `\n`-terminaed lines per se. If any line exists in the output string,
not be `\n`-terminated lines per se. If any line exists in the output string,
the test fails.

```
Expand All @@ -409,7 +409,7 @@ the test fails.

Verifies that the output string contains at least one of the "lines" in the
specified list of lines. In practice, the lines can be any substring and need
not be `\n`-terminaed lines per se. If none of the specified lines is present,
not be `\n`-terminated lines per se. If none of the specified lines is present,
the test fails.

### Reading file contents
Expand Down
8 changes: 4 additions & 4 deletions tools/gyp/docs/UserDocumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describing all the information necessary to build the target.

`'conditions'`: A list of condition specifications that can modify the
contents of the items in the global dictionary defined by this `.gyp`
file based on the values of different variablwes. As implied by the
file based on the values of different variables. As implied by the
above example, the most common use of a `conditions` section in the
top-level dictionary is to add platform-specific targets to the
`targets` list.
Expand Down Expand Up @@ -375,7 +375,7 @@ If your platform-specific file does not contain a
already in the `conditions` for the target), and you can't change the
file name, there are two patterns that can be used.

**Prefererred**: Add the file to the `sources` list of the appropriate
**Preferred**: Add the file to the `sources` list of the appropriate
dictionary within the `targets` list. Add an appropriate `conditions`
section to exclude the specific files name:

Expand Down Expand Up @@ -807,7 +807,7 @@ directory:
```

Adding a library often involves updating multiple `.gyp` files, adding
the target to the approprate `.gyp` file (possibly a newly-added `.gyp`
the target to the appropriate `.gyp` file (possibly a newly-added `.gyp`
file), and updating targets in the other `.gyp` files that depend on
(link with) the new library.

Expand Down Expand Up @@ -858,7 +858,7 @@ because of those settings' being listed in the
`direct_dependent_settings` block.

Note that these settings will likely need to be replicated in the
settings for the library target itsef, so that the library will build
settings for the library target itself, so that the library will build
with the same options. This does not prevent the target from defining
additional options for its "internal" use when compiling its own source
files. (In the above example, these are the `LOCAL_DEFINE_FOR_LIBBAR`
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def find_matching_test_target_names(self):
) & set(self._root_targets)
if matching_test_targets_contains_all:
# Remove any of the targets for all that were not explicitly supplied,
# 'all' is subsequentely added to the matching names below.
# 'all' is subsequently added to the matching names below.
matching_test_targets = list(
set(matching_test_targets) & set(test_targets_no_all)
)
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/generator/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def ExtractIncludesFromCFlags(self, cflags):
Args:
cflags: A list of compiler flags, which may be mixed with "-I.."
Returns:
A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
A tuple of lists: (clean_cflags, include_paths). "-I.." is trimmed.
"""
clean_cflags = []
include_paths = []
Expand Down
12 changes: 6 additions & 6 deletions tools/gyp/pylib/gyp/generator/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, o
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_sources: [(<cmake_src>, <src>)] to append with generated source files.
extra_deps: [<cmake_taget>] to append with generated targets.
extra_deps: [<cmake_target>] to append with generated targets.
path_to_gyp: relative path from CMakeLists.txt being generated to
the Gyp file in which the target being generated is defined.
"""
Expand Down Expand Up @@ -340,7 +340,7 @@ def WriteRules(target_name, rules, extra_sources, extra_deps, path_to_gyp, outpu
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_sources: [(<cmake_src>, <src>)] to append with generated source files.
extra_deps: [<cmake_taget>] to append with generated targets.
extra_deps: [<cmake_target>] to append with generated targets.
path_to_gyp: relative path from CMakeLists.txt being generated to
the Gyp file in which the target being generated is defined.
"""
Expand Down Expand Up @@ -457,7 +457,7 @@ def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):
Args:
target_name: the name of the CMake target being generated.
actions: the Gyp 'actions' dict for this target.
extra_deps: [<cmake_taget>] to append with generated targets.
extra_deps: [<cmake_target>] to append with generated targets.
path_to_gyp: relative path from CMakeLists.txt being generated to
the Gyp file in which the target being generated is defined.
"""
Expand Down Expand Up @@ -603,7 +603,7 @@ class CMakeNamer:
"""

def __init__(self, target_list):
self.cmake_target_base_names_conficting = set()
self.cmake_target_base_names_conflicting = set()

cmake_target_base_names_seen = set()
for qualified_target in target_list:
Expand All @@ -612,11 +612,11 @@ def __init__(self, target_list):
if cmake_target_base_name not in cmake_target_base_names_seen:
cmake_target_base_names_seen.add(cmake_target_base_name)
else:
self.cmake_target_base_names_conficting.add(cmake_target_base_name)
self.cmake_target_base_names_conflicting.add(cmake_target_base_name)

def CreateCMakeTargetName(self, qualified_target):
base_name = CreateCMakeTargetBaseName(qualified_target)
if base_name in self.cmake_target_base_names_conficting:
if base_name in self.cmake_target_base_names_conflicting:
return CreateCMakeTargetFullName(qualified_target)
return base_name

Expand Down
20 changes: 10 additions & 10 deletions tools/gyp/pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def CalculateGeneratorInputInfo(params):

LINK_COMMANDS_MAC = """\
quiet_cmd_alink = LIBTOOL-STATIC $@
cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^)
cmd_alink = rm -f $@ && %(python)s gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %%.o,$^)
quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS)
Expand All @@ -218,7 +218,7 @@ def CalculateGeneratorInputInfo(params):
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
""" # noqa: E501
""" % {'python': sys.executable} # noqa: E501

LINK_COMMANDS_ANDROID = """\
quiet_cmd_alink = AR($(TOOLSET)) $@
Expand Down Expand Up @@ -609,14 +609,14 @@ def CalculateGeneratorInputInfo(params):
# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd
# already.
quiet_cmd_mac_tool = MACTOOL $(4) $<
cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@"
cmd_mac_tool = %(python)s gyp-mac-tool $(4) $< "$@"
quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@
cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4)
cmd_mac_package_framework = %(python)s gyp-mac-tool package-framework "$@" $(4)
quiet_cmd_infoplist = INFOPLIST $@
cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@"
""" # noqa: E501
""" % {'python': sys.executable} # noqa: E501


def WriteRootHeaderSuffixRules(writer):
Expand Down Expand Up @@ -1834,7 +1834,7 @@ def WriteTarget(
# Since this target depends on binary and resources which are in
# nested subfolders, the framework directory will be older than
# its dependencies usually. To prevent this rule from executing
# on every build (expensive, especially with postbuilds), expliclity
# on every build (expensive, especially with postbuilds), explicitly
# update the time on the framework directory.
self.WriteLn("\t@touch -c %s" % QuoteSpaces(self.output))

Expand Down Expand Up @@ -2498,7 +2498,7 @@ def CalculateMakefilePath(build_file, base_name):
"PLI.host": PLI_host,
}
if flavor == "mac":
flock_command = "./gyp-mac-tool flock"
flock_command = "%s gyp-mac-tool flock" % sys.executable
header_params.update(
{
"flock": flock_command,
Expand Down Expand Up @@ -2548,7 +2548,7 @@ def CalculateMakefilePath(build_file, base_name):
header_params.update(
{
"copy_archive_args": copy_archive_arguments,
"flock": "./gyp-flock-tool flock",
"flock": "%s gyp-flock-tool flock" % sys.executable,
"flock_index": 2,
}
)
Expand All @@ -2564,7 +2564,7 @@ def CalculateMakefilePath(build_file, base_name):
{
"copy_archive_args": copy_archive_arguments,
"link_commands": LINK_COMMANDS_AIX,
"flock": "./gyp-flock-tool flock",
"flock": "%s gyp-flock-tool flock" % sys.executable,
"flock_index": 2,
}
)
Expand All @@ -2574,7 +2574,7 @@ def CalculateMakefilePath(build_file, base_name):
{
"copy_archive_args": copy_archive_arguments,
"link_commands": LINK_COMMANDS_OS400,
"flock": "./gyp-flock-tool flock",
"flock": "%s gyp-flock-tool flock" % sys.executable,
"flock_index": 2,
}
)
Expand Down
19 changes: 10 additions & 9 deletions tools/gyp/pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False):
def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
# TODO(bradnelson): ugly hack, fix this more generally!!!
if "Directories" in setting or "Dependencies" in setting:
if type(value) == str:
if isinstance(value, str):
value = value.replace("/", "\\")
else:
value = [i.replace("/", "\\") for i in value]
Expand All @@ -288,7 +288,7 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
if tool.get(setting):
if only_if_unset:
return
if type(tool[setting]) == list and type(value) == list:
if isinstance(tool[setting], list) and isinstance(value, list):
tool[setting] += value
else:
raise TypeError(
Expand Down Expand Up @@ -1423,7 +1423,7 @@ def _ConvertToolsToExpectedForm(tools):
# Collapse settings with lists.
settings_fixed = {}
for setting, value in settings.items():
if type(value) == list:
if isinstance(value, list):
if (
tool == "VCLinkerTool" and setting == "AdditionalDependencies"
) or setting == "AdditionalOptions":
Expand Down Expand Up @@ -1816,7 +1816,7 @@ def _DictsToFolders(base_path, bucket, flat):
# Convert to folders recursively.
children = []
for folder, contents in bucket.items():
if type(contents) == dict:
if isinstance(contents, dict):
folder_children = _DictsToFolders(
os.path.join(base_path, folder), contents, flat
)
Expand All @@ -1838,9 +1838,10 @@ def _CollapseSingles(parent, node):
# Recursively explorer the tree of dicts looking for projects which are
# the sole item in a folder which has the same name as the project. Bring
# such projects up one level.
if type(node) == dict and len(node) == 1 and next(iter(node)) == parent + ".vcproj":
if (isinstance(node, dict) and len(node) == 1 and
next(iter(node)) == parent + ".vcproj"):
return node[next(iter(node))]
if type(node) != dict:
if not isinstance(node, dict):
return node
for child in node:
node[child] = _CollapseSingles(child, node[child])
Expand All @@ -1860,7 +1861,7 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
# Walk down from the top until we hit a folder that has more than one entry.
# In practice, this strips the top-level "src/" dir from the hierarchy in
# the solution.
while len(root) == 1 and type(root[next(iter(root))]) == dict:
while len(root) == 1 and isinstance(root[next(iter(root))], dict):
root = root[next(iter(root))]
# Collapse singles.
root = _CollapseSingles("", root)
Expand Down Expand Up @@ -3274,7 +3275,7 @@ def _GetMSBuildPropertyGroup(spec, label, properties):
num_configurations = len(spec["configurations"])

def GetEdges(node):
# Use a definition of edges such that user_of_variable -> used_varible.
# Use a definition of edges such that user_of_variable -> used_variable.
# This happens to be easier in this case, since a variable's
# definition contains all variables it references in a single string.
edges = set()
Expand Down Expand Up @@ -3441,7 +3442,7 @@ def _FinalizeMSBuildSettings(spec, configuration):


def _GetValueFormattedForMSBuild(tool_name, name, value):
if type(value) == list:
if isinstance(value, list):
# For some settings, VS2010 does not automatically extends the settings
# TODO(jeanluc) Is this what we want?
if name in [
Expand Down
Loading

0 comments on commit 6a7d201

Please sign in to comment.