Skip to content

Commit 504250e

Browse files
feat: update gyp-next to v0.19.1 (#3122)
1 parent 2530f51 commit 504250e

28 files changed

+270
-203
lines changed

gyp/.github/workflows/node-gyp.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: node-gyp integration
22
on:
33
push:
4-
branches: [ main ]
54
pull_request:
6-
branches: [ main ]
75
workflow_dispatch:
6+
87
jobs:
9-
integration:
8+
node-gyp-integration:
109
strategy:
1110
fail-fast: false
1211
matrix:

gyp/.github/workflows/nodejs-windows.yml

-32
This file was deleted.

gyp/.github/workflows/nodejs.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Node.js integration
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
nodejs-integration:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
13+
python: ["3.8", "3.10", "3.12", "3.13"]
14+
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- name: Clone gyp-next
18+
uses: actions/checkout@v4
19+
with:
20+
path: gyp-next
21+
- name: Clone nodejs/node
22+
uses: actions/checkout@v4
23+
with:
24+
repository: nodejs/node
25+
path: node
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python }}
29+
allow-prereleases: true
30+
- name: Replace gyp in Node.js
31+
shell: bash
32+
run: |
33+
rm -rf node/tools/gyp
34+
cp -r gyp-next node/tools/gyp
35+
36+
# macOS and Linux
37+
- name: Run configure
38+
if: runner.os != 'Windows'
39+
run: |
40+
cd node
41+
./configure
42+
43+
# Windows
44+
- name: Install deps
45+
if: runner.os == 'Windows'
46+
run: choco install nasm
47+
- name: Run configure
48+
if: runner.os == 'Windows'
49+
run: |
50+
cd node
51+
./vcbuild.bat nobuild

gyp/.github/workflows/Python_tests.yml renamed to gyp/.github/workflows/python_tests.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
name: Python_tests
55
on:
66
push:
7-
branches: [ main ]
87
pull_request:
9-
branches: [ main ]
108
workflow_dispatch:
9+
1110
jobs:
1211
Python_tests:
1312
runs-on: ${{ matrix.os }}
@@ -24,14 +23,14 @@ jobs:
2423
with:
2524
python-version: ${{ matrix.python-version }}
2625
allow-prereleases: true
27-
- uses: seanmiddleditch/gha-setup-ninja@v4
26+
- uses: seanmiddleditch/gha-setup-ninja@v5
2827
- name: Install dependencies
2928
run: |
3029
python -m pip install --upgrade pip setuptools
3130
pip install --editable ".[dev]"
3231
- run: ./gyp -V && ./gyp --version && gyp -V && gyp --version
3332
- name: Lint with ruff # See pyproject.toml for settings
34-
run: ruff --output-format=github .
33+
run: ruff check --output-format=github .
3534
- name: Test with pytest # See pyproject.toml for settings
3635
run: pytest
3736
# - name: Run doctests with pytest

gyp/.github/workflows/release-please.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
name: python-package-distributions
8181
path: dist/
8282
- name: Sign the dists with Sigstore
83-
uses: sigstore/gh-action-sigstore-python@v2.1.1
83+
uses: sigstore/gh-action-sigstore-python@v3.0.0
8484
with:
8585
inputs: >-
8686
./dist/*.tar.gz

gyp/.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.18.1"
2+
".": "0.19.1"
33
}

gyp/CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Changelog
22

3+
## [0.19.1](https://github.com./nodejs/gyp-next/compare/v0.19.0...v0.19.1) (2024-12-09)
4+
5+
6+
### Bug Fixes
7+
8+
* fixup for break in EscapeForCString ([#274](https://github.com./nodejs/gyp-next/issues/274)) ([610f661](https://github.com./nodejs/gyp-next/commit/610f661da877a358c8b3cbc106b528fb1d0b8095))
9+
10+
## [0.19.0](https://github.com./nodejs/gyp-next/compare/v0.18.3...v0.19.0) (2024-12-03)
11+
12+
13+
### Features
14+
15+
* 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))
16+
17+
## [0.18.3](https://github.com./nodejs/gyp-next/compare/v0.18.2...v0.18.3) (2024-10-08)
18+
19+
20+
### Bug Fixes
21+
22+
* enable pch for clang on windows ([#268](https://github.com./nodejs/gyp-next/issues/268)) ([cc5838c](https://github.com./nodejs/gyp-next/commit/cc5838c4e9260bf459d71de53fbb2eebd1a6f508))
23+
24+
## [0.18.2](https://github.com./nodejs/gyp-next/compare/v0.18.1...v0.18.2) (2024-09-23)
25+
26+
27+
### Bug Fixes
28+
29+
* 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))
30+
* fix E721 lint errors ([#206](https://github.com./nodejs/gyp-next/issues/206)) ([d1299a4](https://github.com./nodejs/gyp-next/commit/d1299a49d313eccabecf97ccb56fc033afad39ad))
31+
332
## [0.18.1](https://github.com./nodejs/gyp-next/compare/v0.18.0...v0.18.1) (2024-05-26)
433

534

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

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

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

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`

gyp/pylib/gyp/MSVSSettings.py

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

173173
def ConvertToMSBuild(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
return msbuild_format % int(value)
176176

177177

gyp/pylib/gyp/MSVSVersion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def UsesVcxproj(self):
6969

7070
def ProjectExtension(self):
7171
"""Returns the file extension for the project."""
72-
return self.uses_vcxproj and ".vcxproj" or ".vcproj"
72+
return (self.uses_vcxproj and ".vcxproj") or ".vcproj"
7373

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

gyp/pylib/gyp/__init__.py

+23-10
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__ import annotations
88
import copy
99
import gyp.input
1010
import argparse
@@ -24,6 +24,18 @@
2424
DEBUG_VARIABLES = "variables"
2525
DEBUG_INCLUDES = "includes"
2626

27+
def EscapeForCString(string: bytes | str) -> str:
28+
if isinstance(string, str):
29+
string = string.encode(encoding='utf8')
30+
31+
backslash_or_double_quote = {ord('\\'), ord('"')}
32+
result = ''
33+
for char in string:
34+
if char in backslash_or_double_quote or not 32 <= char < 127:
35+
result += '\\%03o' % char
36+
else:
37+
result += chr(char)
38+
return result
2739

2840
def DebugOutput(mode, message, *args):
2941
if "all" in gyp.debug or mode in gyp.debug:
@@ -106,18 +118,19 @@ def Load(
106118

107119
output_dir = params["options"].generator_output or params["options"].toplevel_dir
108120
if default_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
if getattr(generator, "CalculateVariables", None):
@@ -253,7 +266,7 @@ def Noop(value):
253266
for name, metadata in options._regeneration_metadata.items():
254267
opt = metadata["opt"]
255268
value = getattr(options, name)
256-
value_predicate = metadata["type"] == "path" and FixPath or Noop
269+
value_predicate = (metadata["type"] == "path" and FixPath) or Noop
257270
action = metadata["action"]
258271
env_name = metadata["env_name"]
259272
if action == "append":

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
)

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 = []

0 commit comments

Comments
 (0)