Skip to content

Commit e20eef6

Browse files
nodejs-github-botaduh95
authored andcommitted
tools: update gyp-next to 0.19.0
PR-URL: #56158 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent efcc829 commit e20eef6

11 files changed

Lines changed: 53 additions & 36 deletions

File tree

‎tools/gyp/CHANGELOG.md‎

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

3+
## [0.19.0](https://github.com/nodejs/gyp-next/compare/v0.18.3...v0.19.0) (2024-12-03)
4+
5+
6+
### Features
7+
8+
* provide escaped version of `PRODUCT_DIR_ABS` ([#271](https://github.com/nodejs/gyp-next/issues/271)) ([3bf3b1c](https://github.com/nodejs/gyp-next/commit/3bf3b1cda26f16c645e0fdd5582ffbf49d9a2580))
9+
310
## [0.18.3](https://github.com/nodejs/gyp-next/compare/v0.18.2...v0.18.3) (2024-10-08)
411

512

‎tools/gyp/pylib/gyp/MSVSSettings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def ValidateMSBuild(self, value):
171171
int(value, self._msbuild_base)
172172

173173
defConvertToMSBuild(self, value):
174-
msbuild_format= (self._msbuild_base==10) and"%d"or"0x%04x"
174+
msbuild_format= ((self._msbuild_base==10) and"%d")or"0x%04x"
175175
returnmsbuild_format%int(value)
176176

177177

‎tools/gyp/pylib/gyp/MSVSVersion.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def UsesVcxproj(self):
6969

7070
defProjectExtension(self):
7171
"""Returns the file extension for the project."""
72-
returnself.uses_vcxprojand".vcxproj"or".vcproj"
72+
return(self.uses_vcxprojand".vcxproj")or".vcproj"
7373

7474
defPath(self):
7575
"""Returns the path to Visual Studio installation."""

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

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Use of this source code is governed by a BSD-style license that can be
55
# found in the LICENSE file.
66

7-
7+
from __future__ importannotations
88
importcopy
99
importgyp.input
1010
importargparse
@@ -24,6 +24,18 @@
2424
DEBUG_VARIABLES="variables"
2525
DEBUG_INCLUDES="includes"
2626

27+
defEscapeForCString(string: bytes|str) ->str:
28+
ifisinstance(string, str):
29+
string=string.encode(encoding='utf8')
30+
31+
backslash_or_double_quote= {ord('\\'), ord('"')}
32+
result= []
33+
forcharinstring:
34+
ifcharinbackslash_or_double_quoteornot32<=char<127:
35+
result+='\\%03o'%char
36+
else:
37+
result+=chr(char)
38+
returnresult
2739

2840
defDebugOutput(mode, message, *args):
2941
if"all"ingyp.debugormodeingyp.debug:
@@ -106,18 +118,19 @@ def Load(
106118

107119
output_dir=params["options"].generator_outputorparams["options"].toplevel_dir
108120
ifdefault_variables["GENERATOR"] =="ninja":
109-
default_variables.setdefault(
110-
"PRODUCT_DIR_ABS",
111-
os.path.join(
112-
output_dir, "out", default_variables.get("build_type", "default")
113-
),
121+
product_dir_abs=os.path.join(
122+
output_dir, "out", default_variables.get("build_type", "default")
114123
)
115124
else:
116-
default_variables.setdefault(
117-
"PRODUCT_DIR_ABS",
118-
os.path.join(output_dir, default_variables["CONFIGURATION_NAME"]),
125+
product_dir_abs=os.path.join(
126+
output_dir, default_variables["CONFIGURATION_NAME"]
119127
)
120128

129+
default_variables.setdefault("PRODUCT_DIR_ABS", product_dir_abs)
130+
default_variables.setdefault(
131+
"PRODUCT_DIR_ABS_CSTR", EscapeForCString(product_dir_abs)
132+
)
133+
121134
# Give the generator the opportunity to set additional variables based on
122135
# the params it will receive in the output phase.
123136
ifgetattr(generator, "CalculateVariables", None):
@@ -253,7 +266,7 @@ def Noop(value):
253266
forname, metadatainoptions._regeneration_metadata.items():
254267
opt=metadata["opt"]
255268
value=getattr(options, name)
256-
value_predicate=metadata["type"] =="path"andFixPathorNoop
269+
value_predicate=(metadata["type"] =="path"andFixPath)orNoop
257270
action=metadata["action"]
258271
env_name=metadata["env_name"]
259272
ifaction=="append":

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ def __init__(self, generator_flags, flavor):
788788
self.suffix_rules_objdir2= {}
789789

790790
# Generate suffix rules for all compilable extensions.
791-
forextinCOMPILABLE_EXTENSIONS:
791+
forext, valueinCOMPILABLE_EXTENSIONS.items():
792792
# Suffix rules for source folder.
793793
self.suffix_rules_srcdir.update(
794794
{
@@ -797,7 +797,7 @@ def __init__(self, generator_flags, flavor):
797797
$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(srcdir)/%%%s FORCE_DO_CMD
798798
\t@$(call do_cmd,%s,1)
799799
"""
800-
% (ext, COMPILABLE_EXTENSIONS[ext])
800+
% (ext, value)
801801
)
802802
}
803803
)
@@ -810,7 +810,7 @@ def __init__(self, generator_flags, flavor):
810810
$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj).$(TOOLSET)/%%%s FORCE_DO_CMD
811811
\t@$(call do_cmd,%s,1)
812812
"""
813-
% (ext, COMPILABLE_EXTENSIONS[ext])
813+
% (ext, value)
814814
)
815815
}
816816
)
@@ -821,7 +821,7 @@ def __init__(self, generator_flags, flavor):
821821
$(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
822822
\t@$(call do_cmd,%s,1)
823823
"""
824-
% (ext, COMPILABLE_EXTENSIONS[ext])
824+
% (ext, value)
825825
)
826826
}
827827
)
@@ -1779,13 +1779,13 @@ def WriteTarget(
17791779
# using ":=".
17801780
self.WriteSortedXcodeEnv(self.output, self.GetSortedXcodePostbuildEnv())
17811781

1782-
forconfignameintarget_postbuilds:
1782+
forconfigname, valueintarget_postbuilds.items():
17831783
self.WriteLn(
17841784
"%s: TARGET_POSTBUILDS_%s := %s"
17851785
% (
17861786
QuoteSpaces(self.output),
17871787
configname,
1788-
gyp.common.EncodePOSIXShellList(target_postbuilds[configname]),
1788+
gyp.common.EncodePOSIXShellList(value),
17891789
)
17901790
)
17911791

‎tools/gyp/pylib/gyp/input.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,11 +2469,8 @@ def SetUpConfigurations(target, target_dict):
24692469
merged_configurations[configuration] =new_configuration_dict
24702470

24712471
# Put the new configurations back into the target dict as a configuration.
2472-
forconfigurationinmerged_configurations:
2473-
target_dict["configurations"][configuration] =merged_configurations[
2474-
configuration
2475-
]
2476-
2472+
forconfiguration, valueinmerged_configurations.items():
2473+
target_dict["configurations"][configuration] =value
24772474
# Now drop all the abstract ones.
24782475
configs=target_dict["configurations"]
24792476
target_dict["configurations"] = {
@@ -3020,8 +3017,8 @@ def Load(
30203017
deltarget_dict[key]
30213018
ProcessListFiltersInDict(target_name, tmp_dict)
30223019
# Write the results back to |target_dict|.
3023-
forkeyintmp_dict:
3024-
target_dict[key] =tmp_dict[key]
3020+
forkey, valueintmp_dict.items():
3021+
target_dict[key] =value
30253022

30263023
# Make sure every dependency appears at most once.
30273024
RemoveDuplicateDependencies(targets)

‎tools/gyp/pylib/gyp/xcode_emulation.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,8 +1127,8 @@ def _GetIOSPostbuilds(self, configname, output_binary):
11271127
be deployed to a device. This should be run as the very last step of the
11281128
build."""
11291129
ifnot (
1130-
self.isIOS
1131-
and (self.spec["type"] =="executable"orself._IsXCTest())
1130+
(self.isIOS
1131+
and (self.spec["type"] =="executable"orself._IsXCTest()))
11321132
orself.IsIosFramework()
11331133
):
11341134
return []

‎tools/gyp/pylib/gyp/xcodeproj_file.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,10 +3017,10 @@ def _AllSymrootsUnique(self, target, inherit_unique_symroot):
30173017
symroots=self._DefinedSymroots(target)
30183018
forsinself._DefinedSymroots(target):
30193019
if (
3020-
sisnotNone
3021-
andnotself._IsUniqueSymrootForTarget(s)
3022-
orsisNone
3023-
andnotinherit_unique_symroot
3020+
(sisnotNone
3021+
andnotself._IsUniqueSymrootForTarget(s))
3022+
or(sisNone
3023+
andnotinherit_unique_symroot)
30243024
):
30253025
returnFalse
30263026
returnTrueifsymrootselseinherit_unique_symroot

‎tools/gyp/pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "gyp-next"
7-
version = "0.18.3"
7+
version = "0.19.0"
88
authors = [
99
{ name="Node.js contributors", email="ryzokuken@disroot.org" },
1010
]

‎tools/gyp/tools/pretty_sln.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ def ParseSolution(solution_file):
9393
continue
9494

9595
# Change all dependencies clsid to name instead.
96-
forprojectindependencies:
96+
forproject, depsindependencies.items():
9797
# For each dependencies in this project
9898
new_dep_array= []
99-
fordepindependencies[project]:
99+
fordepindeps:
100100
# Look for the project name matching this cldis
101101
forproject_infoinprojects:
102102
ifprojects[project_info][1] ==dep:

0 commit comments

Comments
 (0)