From 12f41ab9e8b0da774826b57ef78d0d75cca978f4 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Thu, 1 Oct 2026 00:30:39 +0000 Subject: [PATCH 1/2] feat: update gyp-next to v0.22.3 --- gyp/.github/dependabot.yml | 4 ++++ gyp/.github/workflows/node-gyp.yml | 1 + gyp/.github/workflows/nodejs.yml | 1 + gyp/.github/workflows/python_tests.yml | 4 ++-- gyp/.github/workflows/release-please.yml | 10 +++++----- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gyp/.github/dependabot.yml b/gyp/.github/dependabot.yml index 58d68276fc..1a5cdb30bd 100644 --- a/gyp/.github/dependabot.yml +++ b/gyp/.github/dependabot.yml @@ -10,6 +10,8 @@ updates: - "*" # Group all Actions updates into a single larger pull request schedule: interval: weekly + cooldown: + default-days: 7 - package-ecosystem: "pip" directory: "/" groups: @@ -18,3 +20,5 @@ updates: - "*" # Group all pip updates into a single larger pull request schedule: interval: weekly + cooldown: + default-days: 7 diff --git a/gyp/.github/workflows/node-gyp.yml b/gyp/.github/workflows/node-gyp.yml index e38d9c8fa2..cc7d4bf3f1 100644 --- a/gyp/.github/workflows/node-gyp.yml +++ b/gyp/.github/workflows/node-gyp.yml @@ -29,6 +29,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: path: gyp-next + persist-credentials: false - name: Clone nodejs/node-gyp uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: diff --git a/gyp/.github/workflows/nodejs.yml b/gyp/.github/workflows/nodejs.yml index 12849c809d..aecdfce173 100644 --- a/gyp/.github/workflows/nodejs.yml +++ b/gyp/.github/workflows/nodejs.yml @@ -27,6 +27,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: path: gyp-next + persist-credentials: false - name: Clone nodejs/node uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: diff --git a/gyp/.github/workflows/python_tests.yml b/gyp/.github/workflows/python_tests.yml index d73c6121c1..ab673bd3cf 100644 --- a/gyp/.github/workflows/python_tests.yml +++ b/gyp/.github/workflows/python_tests.yml @@ -16,7 +16,7 @@ jobs: - name: Lint with ruff # See pyproject.toml for settings uses: astral-sh/ruff-action@278981a28ce3188b1e39527901f38254bf3aac89 # v4.1.0 - run: ruff format --check --diff - - uses: wagoid/commitlint-github-action@v6 + - uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1 Python_tests: runs-on: ${{ matrix.os }} @@ -43,7 +43,7 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true - - uses: seanmiddleditch/gha-setup-ninja@v6 + - uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/gyp/.github/workflows/release-please.yml b/gyp/.github/workflows/release-please.yml index 7e3b2e8f08..92138f14b0 100644 --- a/gyp/.github/workflows/release-please.yml +++ b/gyp/.github/workflows/release-please.yml @@ -16,7 +16,7 @@ jobs: contents: write pull-requests: write steps: - - uses: google-github-actions/release-please-action@v4 + - uses: google-github-actions/release-please-action@e4dc86ba9405554aeba3c6bb2d169500e7d3b4ee # v4.1.1 id: release build: @@ -32,7 +32,7 @@ jobs: - name: Build a binary wheel and a source tarball run: pipx run build - name: Store the distribution packages - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: python-package-distributions path: dist/ @@ -52,12 +52,12 @@ jobs: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - name: Download all the dists - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: python-package-distributions path: dist/ - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 github-release: name: >- @@ -72,7 +72,7 @@ jobs: id-token: write # IMPORTANT: mandatory for sigstore steps: - name: Download all the dists - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: python-package-distributions path: dist/ From 0546c386babb5568195663c4f6565dc300cbc30e Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 20 Oct 2026 14:12:20 +0000 Subject: [PATCH 2/2] feat: update gyp-next to v0.22.4 --- gyp/.release-please-manifest.json | 2 +- gyp/CHANGELOG.md | 10 ++++++++ gyp/pylib/gyp/common.py | 8 +++++-- gyp/pylib/gyp/common_test.py | 12 ++++++++++ gyp/pylib/gyp/generator/make.py | 40 +++++++++++++++++++++++++------ gyp/pylib/gyp/generator/ninja.py | 24 +++++++++++++++---- gyp/pylib/gyp/xcode_emulation.py | 5 +++- gyp/pyproject.toml | 2 +- 8 files changed, 87 insertions(+), 16 deletions(-) diff --git a/gyp/.release-please-manifest.json b/gyp/.release-please-manifest.json index b78500f8e2..f7dec0e1ba 100644 --- a/gyp/.release-please-manifest.json +++ b/gyp/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.22.3" + ".": "0.22.4" } diff --git a/gyp/CHANGELOG.md b/gyp/CHANGELOG.md index e590b6fdb8..c0f014ba29 100644 --- a/gyp/CHANGELOG.md +++ b/gyp/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## [0.22.4](https://github.com/nodejs/gyp-next/compare/v0.22.3...v0.22.4) (2026-10-20) + + +### Bug Fixes + +* avoid deprecated os.path.commonprefix() in RelativePath ([#365](https://github.com/nodejs/gyp-next/issues/365)) ([428343e](https://github.com/nodejs/gyp-next/commit/428343ee58c05e7b817d3603688fe7cdb7a10846)), closes [#364](https://github.com/nodejs/gyp-next/issues/364) +* build precompiled headers after generated inputs ([#360](https://github.com/nodejs/gyp-next/issues/360)) ([d8888e9](https://github.com/nodejs/gyp-next/commit/d8888e932040eae90604b77ec6030a25714f0077)) +* include the prefix header itself in assembly sources ([#360](https://github.com/nodejs/gyp-next/issues/360)) ([d8888e9](https://github.com/nodejs/gyp-next/commit/d8888e932040eae90604b77ec6030a25714f0077)) +* **make:** compile the C prefix header with CFLAGS ([#360](https://github.com/nodejs/gyp-next/issues/360)) ([d8888e9](https://github.com/nodejs/gyp-next/commit/d8888e932040eae90604b77ec6030a25714f0077)) + ## [0.22.3](https://github.com/nodejs/gyp-next/compare/v0.22.2...v0.22.3) (2026-09-29) diff --git a/gyp/pylib/gyp/common.py b/gyp/pylib/gyp/common.py index 223ce47b00..c034f69c0a 100644 --- a/gyp/pylib/gyp/common.py +++ b/gyp/pylib/gyp/common.py @@ -157,8 +157,12 @@ def RelativePath(path, relative_to, follow_path_symlink=True): path_split = path.split(os.path.sep) relative_to_split = relative_to.split(os.path.sep) - # Determine how much of the prefix the two paths share. - prefix_len = len(os.path.commonprefix([path_split, relative_to_split])) + # Determine how much of the path prefix the two paths share. + prefix_len = 0 + for path_part, relative_to_part in zip(path_split, relative_to_split): + if path_part != relative_to_part: + break + prefix_len += 1 # Put enough ".." components to back up out of relative_to to the common # prefix, and then append the part of path_split after the common prefix. diff --git a/gyp/pylib/gyp/common_test.py b/gyp/pylib/gyp/common_test.py index b5988816c0..d3e860534d 100755 --- a/gyp/pylib/gyp/common_test.py +++ b/gyp/pylib/gyp/common_test.py @@ -182,5 +182,17 @@ def mock_run(env, defines_stdout, expected_cmd, throws=False): assert flavor6 == "wasi" +class TestRelativePath(unittest.TestCase): + def test_common_parent(self): + assert gyp.common.RelativePath("/a/b", "/a/c") == os.path.join("..", "b") + + def test_only_root_in_common(self): + """Paths whose only common ancestor is the filesystem root.""" + assert gyp.common.RelativePath("/a/b", "/c") == os.path.join("..", "a", "b") + + def test_same_path(self): + assert gyp.common.RelativePath("/a/b", "/a/b") == "" + + if __name__ == "__main__": unittest.main() diff --git a/gyp/pylib/gyp/generator/make.py b/gyp/pylib/gyp/generator/make.py index 16b6f4e80b..c47050a522 100644 --- a/gyp/pylib/gyp/generator/make.py +++ b/gyp/pylib/gyp/generator/make.py @@ -603,7 +603,7 @@ def CalculateGeneratorInputInfo(params): # Commands for precompiled header files. quiet_cmd_pch_c = CXX($(TOOLSET)) $@ -cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< +cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< quiet_cmd_pch_m = CXX($(TOOLSET)) $@ @@ -1485,13 +1485,29 @@ def WriteSources( # See "Target-specific Variable Values" in the GNU Make manual.""" ) self.WriteLn("$(OBJS): TOOLSET := $(TOOLSET)") - self.WriteLn( - "$(OBJS): GYP_CFLAGS := " + gyp_cflags = ( "$(DEFS_$(BUILDTYPE)) " "$(INCS_$(BUILDTYPE)) " - "%s " % precompiled_header.GetInclude("c") + "$(CFLAGS_$(BUILDTYPE)) " + "%s " + "$(CFLAGS_$(BUILDTYPE)) " "$(CFLAGS_C_$(BUILDTYPE))" ) + self.WriteLn( + "$(OBJS): GYP_CFLAGS := " + + gyp_cflags % precompiled_header.GetInclude("c") + ) + asm_objs = [ + obj + for source, obj in zip(compilable, objs) + if source.endswith((".s", ".S")) + ] + if asm_objs and precompiled_header.compile_headers: + # Assembly is compiled with GYP_CFLAGS too, but without a gch + # for it, the -include of the C one fails. + self.WriteLn( + "%s: GYP_CFLAGS := " % " ".join(asm_objs) + + gyp_cflags % precompiled_header.GetInclude("asm") + ) self.WriteLn( "$(OBJS): GYP_CXXFLAGS := " "$(DEFS_$(BUILDTYPE)) " @@ -1521,7 +1537,9 @@ def WriteSources( "$(CFLAGS_OBJCC_$(BUILDTYPE))" ) - self.WritePchTargets(precompiled_header.GetPchBuildCommands()) + self.WritePchTargets( + precompiled_header.GetPchBuildCommands(), deps + extra_outputs + ) # If there are any object files in our input file list, link them into our # output. @@ -1529,8 +1547,13 @@ def WriteSources( self.WriteLn() - def WritePchTargets(self, pch_commands): - """Writes make rules to compile prefix headers.""" + def WritePchTargets(self, pch_commands, order_only_deps): + """Writes make rules to compile prefix headers. + + A prefix header may include generated headers, so like the object files, + the gch files are built after |order_only_deps|: the target's dependencies + and the outputs of its actions and rules. + """ if not pch_commands: return @@ -1547,6 +1570,9 @@ def WritePchTargets(self, pch_commands): "m": "GYP_PCH_OBJCFLAGS", "mm": "GYP_PCH_OBJCXXFLAGS", }[lang] + if order_only_deps: + self.WriteMakeRule([gch], order_only_deps, order_only=True) + self.WriteLn(f"{gch}: TOOLSET := $(TOOLSET)") self.WriteLn( f"{gch}: {var_name} := {lang_flag} " + "$(DEFS_$(BUILDTYPE)) " "$(INCS_$(BUILDTYPE)) " diff --git a/gyp/pylib/gyp/generator/ninja.py b/gyp/pylib/gyp/generator/ninja.py index 3ceaf470ce..49ce563ea7 100644 --- a/gyp/pylib/gyp/generator/ninja.py +++ b/gyp/pylib/gyp/generator/ninja.py @@ -1253,6 +1253,12 @@ def WriteSourcesForArch( cflags_cc, self.ExpandSpecial, ) + elif ext in ("s", "S") and precompiled_header.compile_headers: + # Assembly gets $cflags_pch_c too, but without a gch for it, the + # -include of the C one fails. + variables = [ + ("cflags_pch_c", precompiled_header.GetInclude("asm", arch)) + ] ninja_file.build( output, command, @@ -1274,13 +1280,17 @@ def WriteSourcesForArch( ], ) - self.WritePchTargets(ninja_file, pch_commands) + self.WritePchTargets(ninja_file, pch_commands, predepends) ninja_file.newline() return outputs - def WritePchTargets(self, ninja_file, pch_commands): - """Writes ninja rules to compile prefix headers.""" + def WritePchTargets(self, ninja_file, pch_commands, predepends): + """Writes ninja rules to compile prefix headers. + + A prefix header may include generated headers, so like the object files, + the gch files are built after |predepends|. + """ if not pch_commands: return @@ -1299,7 +1309,13 @@ def WritePchTargets(self, ninja_file, pch_commands): "mm": "objcxx", } cmd = map.get(lang) - ninja_file.build(gch, cmd, input, variables=[(var_name, lang_flag)]) + ninja_file.build( + gch, + cmd, + input, + order_only=predepends, + variables=[(var_name, lang_flag)], + ) def WriteLink(self, spec, config_name, config, link_deps, compile_deps): """Write out a link step. Fills out target.binary.""" diff --git a/gyp/pylib/gyp/xcode_emulation.py b/gyp/pylib/gyp/xcode_emulation.py index d13eaa9af2..7ae3c4f9c4 100644 --- a/gyp/pylib/gyp/xcode_emulation.py +++ b/gyp/pylib/gyp/xcode_emulation.py @@ -1429,7 +1429,10 @@ def _CompiledHeader(self, lang, arch): return h def GetInclude(self, lang, arch=None): - """Gets the cflags to include the prefix header for language |lang|.""" + """Gets the cflags to include the prefix header for language |lang|. + + There is no compiled header for assembly ('asm'), which includes the + prefix header itself.""" if self.compile_headers and lang in self.compiled_headers: return "-include %s" % self._CompiledHeader(lang, arch) elif self.header: diff --git a/gyp/pyproject.toml b/gyp/pyproject.toml index 9ce52a6785..71c24110cd 100644 --- a/gyp/pyproject.toml +++ b/gyp/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "gyp-next" -version = "0.22.3" +version = "0.22.4" authors = [ { name="Node.js contributors", email="ryzokuken@disroot.org" }, ]