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

feat: update gyp-next to v0.19.1 #3122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions gyp/.github/workflows/node-gyp.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: node-gyp integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
integration:
node-gyp-integration:
strategy:
fail-fast: false
matrix:
Expand Down
32 changes: 0 additions & 32 deletions gyp/.github/workflows/nodejs-windows.yml

This file was deleted.

51 changes: 51 additions & 0 deletions gyp/.github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Node.js integration
on:
push:
pull_request:
workflow_dispatch:

jobs:
nodejs-integration:
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-latest, ubuntu-latest, windows-latest]
python: ["3.8", "3.10", "3.12", "3.13"]

runs-on: ${{ matrix.os }}
steps:
- name: Clone gyp-next
uses: actions/checkout@v4
with:
path: gyp-next
- name: Clone nodejs/node
uses: actions/checkout@v4
with:
repository: nodejs/node
path: node
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Replace gyp in Node.js
shell: bash
run: |
rm -rf node/tools/gyp
cp -r gyp-next node/tools/gyp

# macOS and Linux
- name: Run configure
if: runner.os != 'Windows'
run: |
cd node
./configure

# Windows
- name: Install deps
if: runner.os == 'Windows'
run: choco install nasm
- name: Run configure
if: runner.os == 'Windows'
run: |
cd node
./vcbuild.bat nobuild
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
name: Python_tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
Python_tests:
runs-on: ${{ matrix.os }}
Expand All @@ -24,14 +23,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: seanmiddleditch/gha-setup-ninja@v4
- uses: seanmiddleditch/gha-setup-ninja@v5
- name: Install dependencies
run: |
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 .
run: ruff check --output-format=github .
- name: Test with pytest # See pyproject.toml for settings
run: pytest
# - name: Run doctests with pytest
Expand Down
2 changes: 1 addition & 1 deletion gyp/.github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion gyp/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.18.1"
".": "0.19.1"
}
29 changes: 29 additions & 0 deletions gyp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## [0.19.1](https://github.com/nodejs/gyp-next/compare/v0.19.0...v0.19.1) (2024-12-09)


### Bug Fixes

* fixup for break in EscapeForCString ([#274](https://github.com/nodejs/gyp-next/issues/274)) ([610f661](https://github.com/nodejs/gyp-next/commit/610f661da877a358c8b3cbc106b528fb1d0b8095))

## [0.19.0](https://github.com/nodejs/gyp-next/compare/v0.18.3...v0.19.0) (2024-12-03)


### Features

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

## [0.18.3](https://github.com/nodejs/gyp-next/compare/v0.18.2...v0.18.3) (2024-10-08)


### Bug Fixes

* enable pch for clang on windows ([#268](https://github.com/nodejs/gyp-next/issues/268)) ([cc5838c](https://github.com/nodejs/gyp-next/commit/cc5838c4e9260bf459d71de53fbb2eebd1a6f508))

## [0.18.2](https://github.com/nodejs/gyp-next/compare/v0.18.1...v0.18.2) (2024-09-23)


### Bug Fixes

* 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))
* fix E721 lint errors ([#206](https://github.com/nodejs/gyp-next/issues/206)) ([d1299a4](https://github.com/nodejs/gyp-next/commit/d1299a49d313eccabecf97ccb56fc033afad39ad))

## [0.18.1](https://github.com/nodejs/gyp-next/compare/v0.18.0...v0.18.1) (2024-05-26)


Expand Down
2 changes: 1 addition & 1 deletion gyp/docs/Hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See [Testing](Testing.md) for more details on the test framework.
Note that it can be handy to look at the project files output by the tests
to diagnose problems. The easiest way to do that is by kindly asking the
test driver to leave the temporary directories it creates in-place.
This is done by setting the enviroment variable "PRESERVE", e.g.
This is done by setting the environment variable "PRESERVE", e.g.

```
set PRESERVE=all # On Windows
Expand Down
6 changes: 3 additions & 3 deletions gyp/docs/LanguageSpecification.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ have structural meaning for target definitions:
| `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`. |
| `configurations` | A list of dictionaries defining build configurations for the target. See the "Configurations" section below. |
| `copies` | A list of copy actions to perform. See the "Copies" section below. |
| `defines` | A list of preprocesor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
| `defines` | A list of preprocessor definitions to be passed on the command line to the C/C++ compiler (via `-D` or `/D` options). |
| `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`. |
| `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`. |
| `include_dirs` | A list of include directories to be passed on the command line to the C/C++ compiler (via `-I` or `/I` options). |
Expand Down Expand Up @@ -208,8 +208,8 @@ Configuration dictionaries may also contain these elements:

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

A conditional section is introduced with a `conditions` or
Expand Down
6 changes: 3 additions & 3 deletions gyp/docs/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,15 @@ fails the test if it does.

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

```
test.must_not_contain_any_lines(output, lines)
```

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

```
Expand All @@ -409,7 +409,7 @@ the test fails.

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

### Reading file contents
Expand Down
8 changes: 4 additions & 4 deletions gyp/docs/UserDocumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describing all the information necessary to build the target.

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

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

Expand Down Expand Up @@ -807,7 +807,7 @@ directory:
```

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

Expand Down Expand Up @@ -858,7 +858,7 @@ because of those settings' being listed in the
`direct_dependent_settings` block.

Note that these settings will likely need to be replicated in the
settings for the library target itsef, so that the library will build
settings for the library target itself, so that the library will build
with the same options. This does not prevent the target from defining
additional options for its "internal" use when compiling its own source
files. (In the above example, these are the `LOCAL_DEFINE_FOR_LIBBAR`
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/MSVSSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def ValidateMSBuild(self, value):
int(value, self._msbuild_base)

def ConvertToMSBuild(self, value):
msbuild_format = (self._msbuild_base == 10) and "%d" or "0x%04x"
msbuild_format = ((self._msbuild_base == 10) and "%d") or "0x%04x"
return msbuild_format % int(value)


Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/MSVSVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def UsesVcxproj(self):

def ProjectExtension(self):
"""Returns the file extension for the project."""
return self.uses_vcxproj and ".vcxproj" or ".vcproj"
return (self.uses_vcxproj and ".vcxproj") or ".vcproj"

def Path(self):
"""Returns the path to Visual Studio installation."""
Expand Down
33 changes: 23 additions & 10 deletions gyp/pylib/gyp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.


from __future__ import annotations
import copy
import gyp.input
import argparse
Expand All @@ -24,6 +24,18 @@
DEBUG_VARIABLES = "variables"
DEBUG_INCLUDES = "includes"

def EscapeForCString(string: bytes | str) -> str:
if isinstance(string, str):
string = string.encode(encoding='utf8')

backslash_or_double_quote = {ord('\\'), ord('"')}
result = ''
for char in string:
if char in backslash_or_double_quote or not 32 <= char < 127:
result += '\\%03o' % char
else:
result += chr(char)
return result

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

output_dir = params["options"].generator_output or params["options"].toplevel_dir
if default_variables["GENERATOR"] == "ninja":
default_variables.setdefault(
"PRODUCT_DIR_ABS",
os.path.join(
output_dir, "out", default_variables.get("build_type", "default")
),
product_dir_abs = os.path.join(
output_dir, "out", default_variables.get("build_type", "default")
)
else:
default_variables.setdefault(
"PRODUCT_DIR_ABS",
os.path.join(output_dir, default_variables["CONFIGURATION_NAME"]),
product_dir_abs = os.path.join(
output_dir, default_variables["CONFIGURATION_NAME"]
)

default_variables.setdefault("PRODUCT_DIR_ABS", product_dir_abs)
default_variables.setdefault(
"PRODUCT_DIR_ABS_CSTR", EscapeForCString(product_dir_abs)
)

# Give the generator the opportunity to set additional variables based on
# the params it will receive in the output phase.
if getattr(generator, "CalculateVariables", None):
Expand Down Expand Up @@ -253,7 +266,7 @@ def Noop(value):
for name, metadata in options._regeneration_metadata.items():
opt = metadata["opt"]
value = getattr(options, name)
value_predicate = metadata["type"] == "path" and FixPath or Noop
value_predicate = (metadata["type"] == "path" and FixPath) or Noop
action = metadata["action"]
env_name = metadata["env_name"]
if action == "append":
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def find_matching_test_target_names(self):
) & set(self._root_targets)
if matching_test_targets_contains_all:
# Remove any of the targets for all that were not explicitly supplied,
# 'all' is subsequentely added to the matching names below.
# 'all' is subsequently added to the matching names below.
matching_test_targets = list(
set(matching_test_targets) & set(test_targets_no_all)
)
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/generator/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def ExtractIncludesFromCFlags(self, cflags):
Args:
cflags: A list of compiler flags, which may be mixed with "-I.."
Returns:
A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
A tuple of lists: (clean_cflags, include_paths). "-I.." is trimmed.
"""
clean_cflags = []
include_paths = []
Expand Down
Loading