Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: update gyp-next to v0.16.1 #50380

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ select = [
]
exclude = [
"deps",
"tools/gyp",
"tools/inspector_protocol",
"tools/node_modules",
]
Expand Down
4 changes: 0 additions & 4 deletions tools/gyp/.flake8

This file was deleted.

27 changes: 17 additions & 10 deletions tools/gyp/.github/workflows/Python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,36 @@
# TODO: Enable pytest --doctest-modules

name: Python_tests
on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
Python_tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 8
max-parallel: 5
matrix:
os: [macos-latest, ubuntu-latest] # , windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Lint with flake8
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
- name: Test with pytest
python -m pip install --upgrade pip setuptools
pip install --editable ".[dev]"
- run: ./gyp -V && ./gyp --version && gyp -V && gyp --version
- name: Lint with ruff # See pyproject.toml for settings
run: ruff --output-format=github .
- name: Test with pytest # See pyproject.toml for settings
run: pytest
# - name: Run doctests with pytest
# run: pytest --doctest-modules
42 changes: 30 additions & 12 deletions tools/gyp/.github/workflows/node-gyp.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
name: node-gyp integration

on: [push, pull_request]

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
test:
integration:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python: ["3.7", "3.10"]
python: ["3.8", "3.10", "3.12"]

runs-on: ${{ matrix.os }}
steps:
- name: Clone gyp-next
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: gyp-next
- name: Clone nodejs/node-gyp
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nodejs/node-gyp
path: node-gyp
- uses: actions/setup-node@v3
with:
node-version: 14.x
- uses: actions/setup-python@v3
node-version: 18.x
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
allow-prereleases: true
- name: Install Python dependencies
run: |
cd gyp-next
python -m pip install --upgrade pip setuptools
pip install --editable .
pip uninstall -y gyp-next
- name: Install Node.js dependencies
run: |
cd node-gyp
npm install --no-progress
Expand All @@ -36,7 +46,15 @@ jobs:
run: |
rm -rf node-gyp/gyp
cp -r gyp-next node-gyp/gyp
- name: Run tests
- name: Run tests (macOS or Linux)
if: runner.os != 'Windows'
shell: bash
run: |
cd node-gyp
npm test --python="${pythonLocation}/python"
- name: Run tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd node-gyp
npm test
npm run test --python="${env:pythonLocation}\\python.exe"
11 changes: 8 additions & 3 deletions tools/gyp/.github/workflows/nodejs-windows.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: Node.js Windows integration

on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Clone gyp-next
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: gyp-next
- name: Clone nodejs/node
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: nodejs/node
path: node
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/.github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
- uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: python
package-name: gyp-next
bump-minor-pre-major: Yes
bump-minor-pre-major: true
1 change: 1 addition & 0 deletions tools/gyp/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Tom Freudenberg <th.freudenberg@gmail.com>
Julien Brianceau <jbriance@cisco.com>
Refael Ackermann <refack@gmail.com>
Ujjwal Sharma <ryzokuken@disroot.org>
Christian Clauss <cclauss@me.com>
58 changes: 58 additions & 0 deletions tools/gyp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,63 @@
# Changelog

## [0.16.1](https://github.com/nodejs/gyp-next/compare/v0.16.0...v0.16.1) (2023-10-25)


### Bug Fixes

* 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))

## [0.16.0](https://github.com/nodejs/gyp-next/compare/v0.15.1...v0.16.0) (2023-10-23)


### Features

* add VCToolsVersion for msvs ([#209](https://github.com/nodejs/gyp-next/issues/209)) ([0e35ab8](https://github.com/nodejs/gyp-next/commit/0e35ab812d890fb75cf89a19ea72bc93dd6ba186))

## [0.15.1](https://github.com/nodejs/gyp-next/compare/v0.15.0...v0.15.1) (2023-09-08)


### Bug Fixes

* some Python lint issues ([#200](https://github.com/nodejs/gyp-next/issues/200)) ([d2dfe4e](https://github.com/nodejs/gyp-next/commit/d2dfe4e66b64c16b38bef984782db93d12674f05))
* use generator_output as output_dir ([#191](https://github.com/nodejs/gyp-next/issues/191)) ([35ffeb1](https://github.com/nodejs/gyp-next/commit/35ffeb1da8ef3fc8311e2e812cff550568f7e8a2))

## [0.15.0](https://github.com/nodejs/gyp-next/compare/v0.14.1...v0.15.0) (2023-03-30)


### Features

* **msvs:** add SpectreMitigation attribute ([#190](https://github.com/nodejs/gyp-next/issues/190)) ([853e464](https://github.com/nodejs/gyp-next/commit/853e4643b6737224a5aa0720a4108461a0230991))

## [0.14.1](https://github.com/nodejs/gyp-next/compare/v0.14.0...v0.14.1) (2023-02-19)


### Bug Fixes

* flake8 extended-ignore ([#186](https://github.com/nodejs/gyp-next/issues/186)) ([c38493c](https://github.com/nodejs/gyp-next/commit/c38493c2556aa63b6dc40ab585c18aef5ca270d3))
* No build_type in default_variables ([#183](https://github.com/nodejs/gyp-next/issues/183)) ([ac262fe](https://github.com/nodejs/gyp-next/commit/ac262fe82453c4e8dc47529338d157eb0b5ec0fb))


### Documentation

* 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))

## [0.14.0](https://github.com/nodejs/gyp-next/compare/v0.13.0...v0.14.0) (2022-10-08)


### Features

* 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))
* ninja build for iOS ([#174](https://github.com/nodejs/gyp-next/issues/174)) ([b6f2714](https://github.com/nodejs/gyp-next/commit/b6f271424e0033d7ed54d437706695af2ba7a1bf))
* **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))


### Bug Fixes

* lock windows env ([#163](https://github.com/nodejs/gyp-next/issues/163)) ([44bd0dd](https://github.com/nodejs/gyp-next/commit/44bd0ddc93ea0b5770a44dd326a2e4ae62c21442))
* move configuration information into pyproject.toml ([#176](https://github.com/nodejs/gyp-next/issues/176)) ([d69d8ec](https://github.com/nodejs/gyp-next/commit/d69d8ece6dbff7af4f2ea073c9fd170baf8cb7f7))
* 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))

## [0.13.0](https://www.github.com/nodejs/gyp-next/compare/v0.12.1...v0.13.0) (2022-05-11)


Expand Down
23 changes: 23 additions & 0 deletions tools/gyp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,26 @@ Documents are available at [gyp.gsrc.io](https://gyp.gsrc.io), or you can check

__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:
* `python3 -m pip install gyp-next`

When used as a command line utility, __gyp-next__ can also be installed with [pipx](https://pypa.github.io/pipx):
* `pipx install gyp-next`
```
Installing to a new venv 'gyp-next'
installed package gyp-next 0.13.0, installed using Python 3.10.6
These apps are now globally available
- gyp
done! ✨ 🌟 ✨
```

Or to run __gyp-next__ directly without installing it:
* `pipx run gyp-next --help`
```
NOTE: running app 'gyp' from 'gyp-next'
usage: usage: gyp [options ...] [build_file ...]

options:
-h, --help show this help message and exit
--build CONFIGS configuration for build after project generation
--check check format of gyp files
[ ... ]
```
26 changes: 12 additions & 14 deletions tools/gyp/pylib/gyp/MSVSNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,19 +285,17 @@ def Write(self, writer=gyp.common.WriteOnDiff):
"\tEndProjectSection\r\n"
)

if isinstance(e, MSVSFolder):
if e.items:
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
for i in e.items:
f.write(f"\t\t{i} = {i}\r\n")
f.write("\tEndProjectSection\r\n")

if isinstance(e, MSVSProject):
if e.dependencies:
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
for d in e.dependencies:
f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
f.write("\tEndProjectSection\r\n")
if isinstance(e, MSVSFolder) and e.items:
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
for i in e.items:
f.write(f"\t\t{i} = {i}\r\n")
f.write("\tEndProjectSection\r\n")

if isinstance(e, MSVSProject) and e.dependencies:
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
for d in e.dependencies:
f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
f.write("\tEndProjectSection\r\n")

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

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

# Folder mappings
# Omit this section if there are no folders
if any([e.entries for e in all_entries if isinstance(e, MSVSFolder)]):
if any(e.entries for e in all_entries if isinstance(e, MSVSFolder)):
f.write("\tGlobalSection(NestedProjects) = preSolution\r\n")
for e in all_entries:
if not isinstance(e, MSVSFolder):
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/MSVSProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, project_path, version, name, guid=None, platforms=None):
self.files_section = ["Files"]

# Keep a dict keyed on filename to speed up access.
self.files_dict = dict()
self.files_dict = {}

def AddToolFile(self, path):
"""Adds a tool file to the project.
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/MSVSSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class _Boolean(_Type):
"""Boolean settings, can have the values 'false' or 'true'."""

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

def ValidateMSVS(self, value):
Expand Down
18 changes: 16 additions & 2 deletions tools/gyp/pylib/gyp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import traceback
from gyp.common import GypError


# Default debug modes for GYP
debug = {}

Expand Down Expand Up @@ -107,7 +108,9 @@ def Load(
if default_variables["GENERATOR"] == "ninja":
default_variables.setdefault(
"PRODUCT_DIR_ABS",
os.path.join(output_dir, "out", default_variables["build_type"]),
os.path.join(
output_dir, "out", default_variables.get("build_type", "default")
),
)
else:
default_variables.setdefault(
Expand Down Expand Up @@ -463,8 +466,19 @@ def gyp_main(args):
metavar="TARGET",
help="include only TARGET and its deep dependencies",
)
parser.add_argument(
"-V",
"--version",
dest="version",
action="store_true",
help="Show the version and exit.",
)

options, build_files_arg = parser.parse_args(args)
if options.version:
import pkg_resources
print(f"v{pkg_resources.get_distribution('gyp-next').version}")
return 0
build_files = build_files_arg

# Set up the configuration directory (defaults to ~/.gyp)
Expand Down Expand Up @@ -610,7 +624,7 @@ def gyp_main(args):
if options.generator_flags:
gen_flags += options.generator_flags
generator_flags = NameValueListToDict(gen_flags)
if DEBUG_GENERAL in gyp.debug.keys():
if DEBUG_GENERAL in gyp.debug:
DebugOutput(DEBUG_GENERAL, "generator_flags: %s", generator_flags)

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