Skip to content

Commit 22b7a74

Browse files
targosUlisesGascon
authored andcommitted
tools: update gyp-next to v0.16.1
PR-URL: #50380 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent f5ccab5 commit 22b7a74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+5244
-312
lines changed

tools/gyp/.flake8

-4
This file was deleted.

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

+17-10
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,36 @@
22
# TODO: Enable pytest --doctest-modules
33

44
name: Python_tests
5-
on: [push, pull_request]
5+
on:
6+
push:
7+
branches: [ main ]
8+
pull_request:
9+
branches: [ main ]
10+
workflow_dispatch:
611
jobs:
712
Python_tests:
813
runs-on: ${{ matrix.os }}
914
strategy:
1015
fail-fast: false
11-
max-parallel: 8
16+
max-parallel: 5
1217
matrix:
1318
os: [macos-latest, ubuntu-latest] # , windows-latest]
14-
python-version: ["3.7", "3.8", "3.9", "3.10"]
19+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1520
steps:
16-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
1722
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v3
23+
uses: actions/setup-python@v4
1924
with:
2025
python-version: ${{ matrix.python-version }}
26+
allow-prereleases: true
2127
- name: Install dependencies
2228
run: |
23-
python -m pip install --upgrade pip
24-
pip install -r requirements_dev.txt
25-
- name: Lint with flake8
26-
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
27-
- name: Test with pytest
29+
python -m pip install --upgrade pip setuptools
30+
pip install --editable ".[dev]"
31+
- run: ./gyp -V && ./gyp --version && gyp -V && gyp --version
32+
- name: Lint with ruff # See pyproject.toml for settings
33+
run: ruff --output-format=github .
34+
- name: Test with pytest # See pyproject.toml for settings
2835
run: pytest
2936
# - name: Run doctests with pytest
3037
# run: pytest --doctest-modules
+30-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
11
name: node-gyp integration
2-
3-
on: [push, pull_request]
4-
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
workflow_dispatch:
58
jobs:
6-
test:
9+
integration:
710
strategy:
811
fail-fast: false
912
matrix:
1013
os: [macos-latest, ubuntu-latest, windows-latest]
11-
python: ["3.7", "3.10"]
14+
python: ["3.8", "3.10", "3.12"]
1215

1316
runs-on: ${{ matrix.os }}
1417
steps:
1518
- name: Clone gyp-next
16-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
1720
with:
1821
path: gyp-next
1922
- name: Clone nodejs/node-gyp
20-
uses: actions/checkout@v3
23+
uses: actions/checkout@v4
2124
with:
2225
repository: nodejs/node-gyp
2326
path: node-gyp
2427
- uses: actions/setup-node@v3
2528
with:
26-
node-version: 14.x
27-
- uses: actions/setup-python@v3
29+
node-version: 18.x
30+
- uses: actions/setup-python@v4
2831
with:
2932
python-version: ${{ matrix.python }}
30-
- name: Install dependencies
33+
allow-prereleases: true
34+
- name: Install Python dependencies
35+
run: |
36+
cd gyp-next
37+
python -m pip install --upgrade pip setuptools
38+
pip install --editable .
39+
pip uninstall -y gyp-next
40+
- name: Install Node.js dependencies
3141
run: |
3242
cd node-gyp
3343
npm install --no-progress
@@ -36,7 +46,15 @@ jobs:
3646
run: |
3747
rm -rf node-gyp/gyp
3848
cp -r gyp-next node-gyp/gyp
39-
- name: Run tests
49+
- name: Run tests (macOS or Linux)
50+
if: runner.os != 'Windows'
51+
shell: bash
52+
run: |
53+
cd node-gyp
54+
npm test --python="${pythonLocation}/python"
55+
- name: Run tests (Windows)
56+
if: runner.os == 'Windows'
57+
shell: pwsh
4058
run: |
4159
cd node-gyp
42-
npm test
60+
npm run test --python="${env:pythonLocation}\\python.exe"

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
name: Node.js Windows integration
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
49

510
jobs:
611
build-windows:
712
runs-on: windows-latest
813
steps:
914
- name: Clone gyp-next
10-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1116
with:
1217
path: gyp-next
1318
- name: Clone nodejs/node
14-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
1520
with:
1621
repository: nodejs/node
1722
path: node

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
release-please:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: GoogleCloudPlatform/release-please-action@v2
11+
- uses: google-github-actions/release-please-action@v3
1212
with:
1313
token: ${{ secrets.GITHUB_TOKEN }}
1414
release-type: python
1515
package-name: gyp-next
16-
bump-minor-pre-major: Yes
16+
bump-minor-pre-major: true

tools/gyp/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Tom Freudenberg <th.freudenberg@gmail.com>
1414
Julien Brianceau <jbriance@cisco.com>
1515
Refael Ackermann <refack@gmail.com>
1616
Ujjwal Sharma <ryzokuken@disroot.org>
17+
Christian Clauss <cclauss@me.com>

tools/gyp/CHANGELOG.md

+58
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,63 @@
11
# Changelog
22

3+
## [0.16.1](https://github.com/nodejs/gyp-next/compare/v0.16.0...v0.16.1) (2023-10-25)
4+
5+
6+
### Bug Fixes
7+
8+
* add quotes for command in msvs generator ([#217](https://github.com/nodejs/gyp-next/issues/217)) ([d3b7bcd](https://github.com/nodejs/gyp-next/commit/d3b7bcdec90d6c1b1affc15ece706e63007b7264))
9+
10+
## [0.16.0](https://github.com/nodejs/gyp-next/compare/v0.15.1...v0.16.0) (2023-10-23)
11+
12+
13+
### Features
14+
15+
* add VCToolsVersion for msvs ([#209](https://github.com/nodejs/gyp-next/issues/209)) ([0e35ab8](https://github.com/nodejs/gyp-next/commit/0e35ab812d890fb75cf89a19ea72bc93dd6ba186))
16+
17+
## [0.15.1](https://github.com/nodejs/gyp-next/compare/v0.15.0...v0.15.1) (2023-09-08)
18+
19+
20+
### Bug Fixes
21+
22+
* some Python lint issues ([#200](https://github.com/nodejs/gyp-next/issues/200)) ([d2dfe4e](https://github.com/nodejs/gyp-next/commit/d2dfe4e66b64c16b38bef984782db93d12674f05))
23+
* use generator_output as output_dir ([#191](https://github.com/nodejs/gyp-next/issues/191)) ([35ffeb1](https://github.com/nodejs/gyp-next/commit/35ffeb1da8ef3fc8311e2e812cff550568f7e8a2))
24+
25+
## [0.15.0](https://github.com/nodejs/gyp-next/compare/v0.14.1...v0.15.0) (2023-03-30)
26+
27+
28+
### Features
29+
30+
* **msvs:** add SpectreMitigation attribute ([#190](https://github.com/nodejs/gyp-next/issues/190)) ([853e464](https://github.com/nodejs/gyp-next/commit/853e4643b6737224a5aa0720a4108461a0230991))
31+
32+
## [0.14.1](https://github.com/nodejs/gyp-next/compare/v0.14.0...v0.14.1) (2023-02-19)
33+
34+
35+
### Bug Fixes
36+
37+
* flake8 extended-ignore ([#186](https://github.com/nodejs/gyp-next/issues/186)) ([c38493c](https://github.com/nodejs/gyp-next/commit/c38493c2556aa63b6dc40ab585c18aef5ca270d3))
38+
* No build_type in default_variables ([#183](https://github.com/nodejs/gyp-next/issues/183)) ([ac262fe](https://github.com/nodejs/gyp-next/commit/ac262fe82453c4e8dc47529338d157eb0b5ec0fb))
39+
40+
41+
### Documentation
42+
43+
* README.md: Add pipx installation and run instructions ([#165](https://github.com/nodejs/gyp-next/issues/165)) ([4d28b15](https://github.com/nodejs/gyp-next/commit/4d28b155568dc35f11c7f86124d1dd42ba428bed))
44+
45+
## [0.14.0](https://github.com/nodejs/gyp-next/compare/v0.13.0...v0.14.0) (2022-10-08)
46+
47+
48+
### Features
49+
50+
* Add command line argument for `gyp --version` ([#164](https://github.com/nodejs/gyp-next/issues/164)) ([5c9f4d0](https://github.com/nodejs/gyp-next/commit/5c9f4d05678dd855e18ed2327219e5d18e5374db))
51+
* ninja build for iOS ([#174](https://github.com/nodejs/gyp-next/issues/174)) ([b6f2714](https://github.com/nodejs/gyp-next/commit/b6f271424e0033d7ed54d437706695af2ba7a1bf))
52+
* **zos:** support IBM Open XL C/C++ & PL/I compilers on z/OS ([#178](https://github.com/nodejs/gyp-next/issues/178)) ([43a7211](https://github.com/nodejs/gyp-next/commit/43a72110ae3fafb13c9625cc7a969624b27cda47))
53+
54+
55+
### Bug Fixes
56+
57+
* lock windows env ([#163](https://github.com/nodejs/gyp-next/issues/163)) ([44bd0dd](https://github.com/nodejs/gyp-next/commit/44bd0ddc93ea0b5770a44dd326a2e4ae62c21442))
58+
* move configuration information into pyproject.toml ([#176](https://github.com/nodejs/gyp-next/issues/176)) ([d69d8ec](https://github.com/nodejs/gyp-next/commit/d69d8ece6dbff7af4f2ea073c9fd170baf8cb7f7))
59+
* node.js debugger adds stderr (but exit code is 0) -> shouldn't throw ([#179](https://github.com/nodejs/gyp-next/issues/179)) ([1a457d9](https://github.com/nodejs/gyp-next/commit/1a457d9ed08cfd30c9fa551bc5cf0d90fb583787))
60+
361
## [0.13.0](https://www.github.com/nodejs/gyp-next/compare/v0.12.1...v0.13.0) (2022-05-11)
462

563

tools/gyp/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,26 @@ Documents are available at [gyp.gsrc.io](https://gyp.gsrc.io), or you can check
55

66
__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:
77
* `python3 -m pip install gyp-next`
8+
9+
When used as a command line utility, __gyp-next__ can also be installed with [pipx](https://pypa.github.io/pipx):
10+
* `pipx install gyp-next`
11+
```
12+
Installing to a new venv 'gyp-next'
13+
installed package gyp-next 0.13.0, installed using Python 3.10.6
14+
These apps are now globally available
15+
- gyp
16+
done! ✨ 🌟 ✨
17+
```
18+
19+
Or to run __gyp-next__ directly without installing it:
20+
* `pipx run gyp-next --help`
21+
```
22+
NOTE: running app 'gyp' from 'gyp-next'
23+
usage: usage: gyp [options ...] [build_file ...]
24+
25+
options:
26+
-h, --help show this help message and exit
27+
--build CONFIGS configuration for build after project generation
28+
--check check format of gyp files
29+
[ ... ]
30+
```

tools/gyp/pylib/gyp/MSVSNew.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -285,19 +285,17 @@ def Write(self, writer=gyp.common.WriteOnDiff):
285285
"\tEndProjectSection\r\n"
286286
)
287287

288-
if isinstance(e, MSVSFolder):
289-
if e.items:
290-
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
291-
for i in e.items:
292-
f.write(f"\t\t{i} = {i}\r\n")
293-
f.write("\tEndProjectSection\r\n")
294-
295-
if isinstance(e, MSVSProject):
296-
if e.dependencies:
297-
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
298-
for d in e.dependencies:
299-
f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
300-
f.write("\tEndProjectSection\r\n")
288+
if isinstance(e, MSVSFolder) and e.items:
289+
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
290+
for i in e.items:
291+
f.write(f"\t\t{i} = {i}\r\n")
292+
f.write("\tEndProjectSection\r\n")
293+
294+
if isinstance(e, MSVSProject) and e.dependencies:
295+
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
296+
for d in e.dependencies:
297+
f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
298+
f.write("\tEndProjectSection\r\n")
301299

302300
f.write("EndProject\r\n")
303301

@@ -353,7 +351,7 @@ def Write(self, writer=gyp.common.WriteOnDiff):
353351

354352
# Folder mappings
355353
# Omit this section if there are no folders
356-
if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]):
354+
if any(e.entries for e in all_entries if isinstance(e, MSVSFolder)):
357355
f.write("\tGlobalSection(NestedProjects) = preSolution\r\n")
358356
for e in all_entries:
359357
if not isinstance(e, MSVSFolder):

tools/gyp/pylib/gyp/MSVSProject.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, project_path, version, name, guid=None, platforms=None):
7979
self.files_section = ["Files"]
8080

8181
# Keep a dict keyed on filename to speed up access.
82-
self.files_dict = dict()
82+
self.files_dict = {}
8383

8484
def AddToolFile(self, path):
8585
"""Adds a tool file to the project.

tools/gyp/pylib/gyp/MSVSSettings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class _Boolean(_Type):
141141
"""Boolean settings, can have the values 'false' or 'true'."""
142142

143143
def _Validate(self, value):
144-
if value != "true" and value != "false":
144+
if value not in {"true", "false"}:
145145
raise ValueError("expected bool; got %r" % value)
146146

147147
def ValidateMSVS(self, value):

tools/gyp/pylib/gyp/__init__.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import traceback
1616
from gyp.common import GypError
1717

18+
1819
# Default debug modes for GYP
1920
debug = {}
2021

@@ -107,7 +108,9 @@ def Load(
107108
if default_variables["GENERATOR"] == "ninja":
108109
default_variables.setdefault(
109110
"PRODUCT_DIR_ABS",
110-
os.path.join(output_dir, "out", default_variables["build_type"]),
111+
os.path.join(
112+
output_dir, "out", default_variables.get("build_type", "default")
113+
),
111114
)
112115
else:
113116
default_variables.setdefault(
@@ -463,8 +466,19 @@ def gyp_main(args):
463466
metavar="TARGET",
464467
help="include only TARGET and its deep dependencies",
465468
)
469+
parser.add_argument(
470+
"-V",
471+
"--version",
472+
dest="version",
473+
action="store_true",
474+
help="Show the version and exit.",
475+
)
466476

467477
options, build_files_arg = parser.parse_args(args)
478+
if options.version:
479+
import pkg_resources
480+
print(f"v{pkg_resources.get_distribution('gyp-next').version}")
481+
return 0
468482
build_files = build_files_arg
469483

470484
# Set up the configuration directory (defaults to ~/.gyp)
@@ -610,7 +624,7 @@ def gyp_main(args):
610624
if options.generator_flags:
611625
gen_flags += options.generator_flags
612626
generator_flags = NameValueListToDict(gen_flags)
613-
if DEBUG_GENERAL in gyp.debug.keys():
627+
if DEBUG_GENERAL in gyp.debug:
614628
DebugOutput(DEBUG_GENERAL, "generator_flags: %s", generator_flags)
615629

616630
# Generate all requested formats (use a set in case we got one format request

0 commit comments

Comments
 (0)