feat(gyp): update gyp to v0.14.0 (#2749)

This commit is contained in:
Michaël Zasso 2022-10-10 13:51:12 +02:00 committed by GitHub
parent 131d1a463b
commit 713b8dcdbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 141 additions and 67 deletions

View file

@ -2,7 +2,12 @@
# 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 }}
@ -11,17 +16,18 @@ jobs:
max-parallel: 8
matrix:
os: [macos-latest, ubuntu-latest] # , windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
python -m pip install --upgrade pip setuptools
pip install --editable ".[dev]"
- run: ./gyp -V && ./gyp --version && gyp -V && gyp --version
- name: Lint with flake8
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
- name: Test with pytest

View file

@ -1,9 +1,12 @@
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:
@ -24,7 +27,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 14.x
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies

View file

@ -1,10 +1,15 @@
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
runs-on: windows-2019
steps:
- name: Clone gyp-next
uses: actions/checkout@v3

View file

@ -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

View file

@ -1,5 +1,21 @@
# Changelog
## [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)

View file

@ -15,6 +15,7 @@ import sys
import traceback
from gyp.common import GypError
# Default debug modes for GYP
debug = {}
@ -463,8 +464,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)

View file

@ -470,6 +470,7 @@ def CopyTool(flavor, out_path, generator_flags={}):
"os400": "flock",
"solaris": "flock",
"mac": "mac",
"ios": "mac",
"win": "win",
}.get(flavor, None)
if not prefix:

View file

@ -101,6 +101,7 @@ def CalculateVariables(default_variables, params):
default_variables.setdefault("SHARED_LIB_SUFFIX", ".a")
elif flavor == "zos":
default_variables.setdefault("SHARED_LIB_SUFFIX", ".x")
COMPILABLE_EXTENSIONS.update({".pli": "pli"})
else:
default_variables.setdefault("SHARED_LIB_SUFFIX", ".so")
default_variables.setdefault("SHARED_LIB_DIR", "$(builddir)/lib.$(TOOLSET)")
@ -318,7 +319,7 @@ quiet_cmd_link = LINK($(TOOLSET)) $@
cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
quiet_cmd_solink = SOLINK($(TOOLSET)) $@
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,DLL -o $(patsubst %.x,%.so,$@) $(LD_INPUTS) $(LIBS) && if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi
cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_INPUTS) $(LIBS)
quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@
cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS)
@ -378,6 +379,7 @@ CXXFLAGS.target ?= $(CPPFLAGS) $(CXXFLAGS)
LINK.target ?= %(LINK.target)s
LDFLAGS.target ?= $(LDFLAGS)
AR.target ?= $(AR)
PLI.target ?= %(PLI.target)s
# C++ apps need to be linked with g++.
LINK ?= $(CXX.target)
@ -391,6 +393,7 @@ CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host)
LINK.host ?= %(LINK.host)s
LDFLAGS.host ?= $(LDFLAGS_host)
AR.host ?= %(AR.host)s
PLI.host ?= %(PLI.host)s
# Define a dir function that can handle spaces.
# http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
@ -628,6 +631,15 @@ def WriteRootHeaderSuffixRules(writer):
writer.write("\n")
SHARED_HEADER_OS390_COMMANDS = """
PLIFLAGS.target ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS)
PLIFLAGS.host ?= -qlp=64 -qlimits=extname=31 $(PLIFLAGS)
quiet_cmd_pli = PLI($(TOOLSET)) $@
cmd_pli = $(PLI.$(TOOLSET)) $(GYP_PLIFLAGS) $(PLIFLAGS.$(TOOLSET)) -c $< && \
if [ -f $(notdir $@) ]; then /bin/cp $(notdir $@) $@; else true; fi
"""
SHARED_HEADER_SUFFIX_RULES_COMMENT1 = """\
# Suffix rules, putting all outputs into $(obj).
"""
@ -2450,10 +2462,12 @@ def GenerateOutput(target_list, target_dicts, data, params):
"AR.target": GetEnvironFallback(("AR_target", "AR"), "$(AR)"),
"CXX.target": GetEnvironFallback(("CXX_target", "CXX"), "$(CXX)"),
"LINK.target": GetEnvironFallback(("LINK_target", "LINK"), "$(LINK)"),
"PLI.target": GetEnvironFallback(("PLI_target", "PLI"), "pli"),
"CC.host": GetEnvironFallback(("CC_host", "CC"), "gcc"),
"AR.host": GetEnvironFallback(("AR_host", "AR"), "ar"),
"CXX.host": GetEnvironFallback(("CXX_host", "CXX"), "g++"),
"LINK.host": GetEnvironFallback(("LINK_host", "LINK"), "$(CXX.host)"),
"PLI.host": GetEnvironFallback(("PLI_host", "PLI"), "pli"),
}
if flavor == "mac":
flock_command = "./gyp-mac-tool flock"
@ -2469,16 +2483,36 @@ def GenerateOutput(target_list, target_dicts, data, params):
header_params.update({"link_commands": LINK_COMMANDS_ANDROID})
elif flavor == "zos":
copy_archive_arguments = "-fPR"
makedep_arguments = "-qmakedep=gcc"
CC_target = GetEnvironFallback(("CC_target", "CC"), "njsc")
makedep_arguments = "-MMD"
if CC_target == "clang":
CC_host = GetEnvironFallback(("CC_host", "CC"), "clang")
CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "clang++")
CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "clang++")
elif CC_target == "ibm-clang64":
CC_host = GetEnvironFallback(("CC_host", "CC"), "ibm-clang64")
CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "ibm-clang++64")
CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "ibm-clang++64")
elif CC_target == "ibm-clang":
CC_host = GetEnvironFallback(("CC_host", "CC"), "ibm-clang")
CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "ibm-clang++")
CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "ibm-clang++")
else:
# Node.js versions prior to v18:
makedep_arguments = "-qmakedep=gcc"
CC_host = GetEnvironFallback(("CC_host", "CC"), "njsc")
CXX_target = GetEnvironFallback(("CXX_target", "CXX"), "njsc++")
CXX_host = GetEnvironFallback(("CXX_host", "CXX"), "njsc++")
header_params.update(
{
"copy_archive_args": copy_archive_arguments,
"makedep_args": makedep_arguments,
"link_commands": LINK_COMMANDS_OS390,
"CC.target": GetEnvironFallback(("CC_target", "CC"), "njsc"),
"CXX.target": GetEnvironFallback(("CXX_target", "CXX"), "njsc++"),
"CC.host": GetEnvironFallback(("CC_host", "CC"), "njsc"),
"CXX.host": GetEnvironFallback(("CXX_host", "CXX"), "njsc++"),
"extra_commands": SHARED_HEADER_OS390_COMMANDS,
"CC.target": CC_target,
"CXX.target": CXX_target,
"CC.host": CC_host,
"CXX.host": CXX_host,
}
)
elif flavor == "solaris":

View file

@ -1583,7 +1583,7 @@ class NinjaWriter:
elif spec["type"] == "static_library":
self.target.binary = self.ComputeOutput(spec)
if (
self.flavor not in ("mac", "openbsd", "netbsd", "win")
self.flavor not in ("ios", "mac", "netbsd", "openbsd", "win")
and not self.is_standalone_static_library
):
self.ninja.build(
@ -2496,7 +2496,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name
),
)
if flavor != "mac" and flavor != "win":
if flavor not in ("ios", "mac", "win"):
master_ninja.rule(
"alink",
description="AR $out",

View file

@ -2990,7 +2990,7 @@ class PBXProject(XCContainerPortal):
# Xcode seems to sort this list case-insensitively
self._properties["projectReferences"] = sorted(
self._properties["projectReferences"],
key=lambda x: x["ProjectRef"].Name().lower
key=lambda x: x["ProjectRef"].Name().lower()
)
else:
# The link already exists. Pull out the relevnt data.

41
gyp/pyproject.toml Normal file
View file

@ -0,0 +1,41 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "gyp-next"
version = "0.14.0"
authors = [
{ name="Node.js contributors", email="ryzokuken@disroot.org" },
]
description = "A fork of the GYP build system for use in the Node.js projects"
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.6"
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
[project.optional-dependencies]
dev = ["flake8", "pytest"]
[project.scripts]
gyp = "gyp:script_main"
[project.urls]
"Homepage" = "https://github.com/nodejs/gyp-next"
[tool.setuptools]
package-dir = {"" = "pylib"}
packages = ["gyp", "gyp.generator"]

View file

@ -1,2 +0,0 @@
flake8
pytest

View file

@ -1,42 +0,0 @@
#!/usr/bin/env python3
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, "README.md")) as in_file:
long_description = in_file.read()
setup(
name="gyp-next",
version="0.13.0",
description="A fork of the GYP build system for use in the Node.js projects",
long_description=long_description,
long_description_content_type="text/markdown",
author="Node.js contributors",
author_email="ryzokuken@disroot.org",
url="https://github.com/nodejs/gyp-next",
package_dir={"": "pylib"},
packages=["gyp", "gyp.generator"],
entry_points={"console_scripts": ["gyp=gyp:script_main"]},
python_requires=">=3.6",
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
)