Skip to content

Commit 6a7d201

Browse files
nodejs-github-botaduh95
authored andcommitted
tools: update gyp-next to 0.18.2
PR-URL: #55160 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent 77f8a3f commit 6a7d201

18 files changed

+141
-126
lines changed

tools/gyp/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [0.18.2](https://github.com/nodejs/gyp-next/compare/v0.18.1...v0.18.2) (2024-09-23)
4+
5+
6+
### Bug Fixes
7+
8+
* 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))
9+
* fix E721 lint errors ([#206](https://github.com/nodejs/gyp-next/issues/206)) ([d1299a4](https://github.com/nodejs/gyp-next/commit/d1299a49d313eccabecf97ccb56fc033afad39ad))
10+
311
## [0.18.1](https://github.com/nodejs/gyp-next/compare/v0.18.0...v0.18.1) (2024-05-26)
412

513

tools/gyp/docs/Hacking.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ See [Testing](Testing.md) for more details on the test framework.
3434
Note that it can be handy to look at the project files output by the tests
3535
to diagnose problems. The easiest way to do that is by kindly asking the
3636
test driver to leave the temporary directories it creates in-place.
37-
This is done by setting the enviroment variable "PRESERVE", e.g.
37+
This is done by setting the environment variable "PRESERVE", e.g.
3838

3939
```
4040
set PRESERVE=all # On Windows

tools/gyp/docs/LanguageSpecification.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ have structural meaning for target definitions:
157157
| `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`. |
158158
| `configurations` | A list of dictionaries defining build configurations for the target. See the "Configurations" section below. |
159159
| `copies` | A list of copy actions to perform. See the "Copies" section below. |
160-
| `defines` | A list of preprocesor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
160+
| `defines` | A list of preprocessor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
161161
| `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`. |
162162
| `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`. |
163163
| `include_dirs` | A list of include directories to be passed on the command line to the C/C++ compiler (via `-I` or `/I` options). |
@@ -208,8 +208,8 @@ Configuration dictionaries may also contain these elements:
208208

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

215215
A conditional section is introduced with a `conditions` or

tools/gyp/docs/Testing.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,15 @@ fails the test if it does.
392392

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

397397
```
398398
test.must_not_contain_any_lines(output, lines)
399399
```
400400

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

406406
```
@@ -409,7 +409,7 @@ the test fails.
409409

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

415415
### Reading file contents

tools/gyp/docs/UserDocumentation.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describing all the information necessary to build the target.
104104

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

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

@@ -807,7 +807,7 @@ directory:
807807
```
808808

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

@@ -858,7 +858,7 @@ because of those settings' being listed in the
858858
`direct_dependent_settings` block.
859859

860860
Note that these settings will likely need to be replicated in the
861-
settings for the library target itsef, so that the library will build
861+
settings for the library target itself, so that the library will build
862862
with the same options. This does not prevent the target from defining
863863
additional options for its "internal" use when compiling its own source
864864
files. (In the above example, these are the `LOCAL_DEFINE_FOR_LIBBAR`

tools/gyp/pylib/gyp/generator/analyzer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def find_matching_test_target_names(self):
699699
) & set(self._root_targets)
700700
if matching_test_targets_contains_all:
701701
# Remove any of the targets for all that were not explicitly supplied,
702-
# 'all' is subsequentely added to the matching names below.
702+
# 'all' is subsequently added to the matching names below.
703703
matching_test_targets = list(
704704
set(matching_test_targets) & set(test_targets_no_all)
705705
)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def ExtractIncludesFromCFlags(self, cflags):
769769
Args:
770770
cflags: A list of compiler flags, which may be mixed with "-I.."
771771
Returns:
772-
A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
772+
A tuple of lists: (clean_cflags, include_paths). "-I.." is trimmed.
773773
"""
774774
clean_cflags = []
775775
include_paths = []

tools/gyp/pylib/gyp/generator/cmake.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def WriteActions(target_name, actions, extra_sources, extra_deps, path_to_gyp, o
251251
target_name: the name of the CMake target being generated.
252252
actions: the Gyp 'actions' dict for this target.
253253
extra_sources: [(<cmake_src>, <src>)] to append with generated source files.
254-
extra_deps: [<cmake_taget>] to append with generated targets.
254+
extra_deps: [<cmake_target>] to append with generated targets.
255255
path_to_gyp: relative path from CMakeLists.txt being generated to
256256
the Gyp file in which the target being generated is defined.
257257
"""
@@ -340,7 +340,7 @@ def WriteRules(target_name, rules, extra_sources, extra_deps, path_to_gyp, outpu
340340
target_name: the name of the CMake target being generated.
341341
actions: the Gyp 'actions' dict for this target.
342342
extra_sources: [(<cmake_src>, <src>)] to append with generated source files.
343-
extra_deps: [<cmake_taget>] to append with generated targets.
343+
extra_deps: [<cmake_target>] to append with generated targets.
344344
path_to_gyp: relative path from CMakeLists.txt being generated to
345345
the Gyp file in which the target being generated is defined.
346346
"""
@@ -457,7 +457,7 @@ def WriteCopies(target_name, copies, extra_deps, path_to_gyp, output):
457457
Args:
458458
target_name: the name of the CMake target being generated.
459459
actions: the Gyp 'actions' dict for this target.
460-
extra_deps: [<cmake_taget>] to append with generated targets.
460+
extra_deps: [<cmake_target>] to append with generated targets.
461461
path_to_gyp: relative path from CMakeLists.txt being generated to
462462
the Gyp file in which the target being generated is defined.
463463
"""
@@ -603,7 +603,7 @@ class CMakeNamer:
603603
"""
604604

605605
def __init__(self, target_list):
606-
self.cmake_target_base_names_conficting = set()
606+
self.cmake_target_base_names_conflicting = set()
607607

608608
cmake_target_base_names_seen = set()
609609
for qualified_target in target_list:
@@ -612,11 +612,11 @@ def __init__(self, target_list):
612612
if cmake_target_base_name not in cmake_target_base_names_seen:
613613
cmake_target_base_names_seen.add(cmake_target_base_name)
614614
else:
615-
self.cmake_target_base_names_conficting.add(cmake_target_base_name)
615+
self.cmake_target_base_names_conflicting.add(cmake_target_base_name)
616616

617617
def CreateCMakeTargetName(self, qualified_target):
618618
base_name = CreateCMakeTargetBaseName(qualified_target)
619-
if base_name in self.cmake_target_base_names_conficting:
619+
if base_name in self.cmake_target_base_names_conflicting:
620620
return CreateCMakeTargetFullName(qualified_target)
621621
return base_name
622622

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

+10-10
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def CalculateGeneratorInputInfo(params):
208208

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

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

621621

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

@@ -2498,7 +2498,7 @@ def CalculateMakefilePath(build_file, base_name):
24982498
"PLI.host": PLI_host,
24992499
}
25002500
if flavor == "mac":
2501-
flock_command = "./gyp-mac-tool flock"
2501+
flock_command = "%s gyp-mac-tool flock" % sys.executable
25022502
header_params.update(
25032503
{
25042504
"flock": flock_command,
@@ -2548,7 +2548,7 @@ def CalculateMakefilePath(build_file, base_name):
25482548
header_params.update(
25492549
{
25502550
"copy_archive_args": copy_archive_arguments,
2551-
"flock": "./gyp-flock-tool flock",
2551+
"flock": "%s gyp-flock-tool flock" % sys.executable,
25522552
"flock_index": 2,
25532553
}
25542554
)
@@ -2564,7 +2564,7 @@ def CalculateMakefilePath(build_file, base_name):
25642564
{
25652565
"copy_archive_args": copy_archive_arguments,
25662566
"link_commands": LINK_COMMANDS_AIX,
2567-
"flock": "./gyp-flock-tool flock",
2567+
"flock": "%s gyp-flock-tool flock" % sys.executable,
25682568
"flock_index": 2,
25692569
}
25702570
)
@@ -2574,7 +2574,7 @@ def CalculateMakefilePath(build_file, base_name):
25742574
{
25752575
"copy_archive_args": copy_archive_arguments,
25762576
"link_commands": LINK_COMMANDS_OS400,
2577-
"flock": "./gyp-flock-tool flock",
2577+
"flock": "%s gyp-flock-tool flock" % sys.executable,
25782578
"flock_index": 2,
25792579
}
25802580
)

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

+10-9
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _ToolAppend(tools, tool_name, setting, value, only_if_unset=False):
276276
def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
277277
# TODO(bradnelson): ugly hack, fix this more generally!!!
278278
if "Directories" in setting or "Dependencies" in setting:
279-
if type(value) == str:
279+
if isinstance(value, str):
280280
value = value.replace("/", "\\")
281281
else:
282282
value = [i.replace("/", "\\") for i in value]
@@ -288,7 +288,7 @@ def _ToolSetOrAppend(tools, tool_name, setting, value, only_if_unset=False):
288288
if tool.get(setting):
289289
if only_if_unset:
290290
return
291-
if type(tool[setting]) == list and type(value) == list:
291+
if isinstance(tool[setting], list) and isinstance(value, list):
292292
tool[setting] += value
293293
else:
294294
raise TypeError(
@@ -1423,7 +1423,7 @@ def _ConvertToolsToExpectedForm(tools):
14231423
# Collapse settings with lists.
14241424
settings_fixed = {}
14251425
for setting, value in settings.items():
1426-
if type(value) == list:
1426+
if isinstance(value, list):
14271427
if (
14281428
tool == "VCLinkerTool" and setting == "AdditionalDependencies"
14291429
) or setting == "AdditionalOptions":
@@ -1816,7 +1816,7 @@ def _DictsToFolders(base_path, bucket, flat):
18161816
# Convert to folders recursively.
18171817
children = []
18181818
for folder, contents in bucket.items():
1819-
if type(contents) == dict:
1819+
if isinstance(contents, dict):
18201820
folder_children = _DictsToFolders(
18211821
os.path.join(base_path, folder), contents, flat
18221822
)
@@ -1838,9 +1838,10 @@ def _CollapseSingles(parent, node):
18381838
# Recursively explorer the tree of dicts looking for projects which are
18391839
# the sole item in a folder which has the same name as the project. Bring
18401840
# such projects up one level.
1841-
if type(node) == dict and len(node) == 1 and next(iter(node)) == parent + ".vcproj":
1841+
if (isinstance(node, dict) and len(node) == 1 and
1842+
next(iter(node)) == parent + ".vcproj"):
18421843
return node[next(iter(node))]
1843-
if type(node) != dict:
1844+
if not isinstance(node, dict):
18441845
return node
18451846
for child in node:
18461847
node[child] = _CollapseSingles(child, node[child])
@@ -1860,7 +1861,7 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
18601861
# Walk down from the top until we hit a folder that has more than one entry.
18611862
# In practice, this strips the top-level "src/" dir from the hierarchy in
18621863
# the solution.
1863-
while len(root) == 1 and type(root[next(iter(root))]) == dict:
1864+
while len(root) == 1 and isinstance(root[next(iter(root))], dict):
18641865
root = root[next(iter(root))]
18651866
# Collapse singles.
18661867
root = _CollapseSingles("", root)
@@ -3274,7 +3275,7 @@ def _GetMSBuildPropertyGroup(spec, label, properties):
32743275
num_configurations = len(spec["configurations"])
32753276

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

34423443

34433444
def _GetValueFormattedForMSBuild(tool_name, name, value):
3444-
if type(value) == list:
3445+
if isinstance(value, list):
34453446
# For some settings, VS2010 does not automatically extends the settings
34463447
# TODO(jeanluc) Is this what we want?
34473448
if name in [

0 commit comments

Comments
 (0)