Skip to content

tools: update gyp-next to 0.20.0 #57683

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

Merged
merged 1 commit into from
Apr 10, 2025
Merged
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
3 changes: 3 additions & 0 deletions tools/gyp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,6 @@ cython_debug/
# static files generated from Django application using `collectstatic`
media
static

test/fixtures/out
*.actual
13 changes: 13 additions & 0 deletions tools/gyp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [0.20.0](https://github.com/nodejs/gyp-next/compare/v0.19.1...v0.20.0) (2025-03-27)


### ⚠ BREAKING CHANGES

* resolve issue with relative paths during linking ([#284](https://github.com/nodejs/gyp-next/issues/284))

### Bug Fixes

* python lint more ruff rules ([#291](https://github.com/nodejs/gyp-next/issues/291)) ([fabc78c](https://github.com/nodejs/gyp-next/commit/fabc78caffcf988365d970ced5a151f40525077e))
* remove explicit installation of setuptools ([#278](https://github.com/nodejs/gyp-next/issues/278)) ([e476778](https://github.com/nodejs/gyp-next/commit/e4767782c70ca8427184694589d9f0ded5eeed22))
* resolve issue with relative paths during linking ([#284](https://github.com/nodejs/gyp-next/issues/284)) ([a2d7439](https://github.com/nodejs/gyp-next/commit/a2d7439fbd3c03f01e1149fdbe682f754bc6cc7f))

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


Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/docs/Hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ to make sure your changes aren't breaking anything important.
You run the test driver with e.g.

``` sh
$ python -m pip install --upgrade pip setuptools
$ python -m pip install --upgrade pip
$ pip install --editable ".[dev]"
$ python -m pytest
```
Expand Down
5 changes: 4 additions & 1 deletion tools/gyp/docs/InputFormatReference.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ lists associated with the following keys, are treated as pathnames:
* include\_dirs
* inputs
* libraries
* library\_dirs
* outputs
* sources
* mac\_bundle\_resources
Expand Down Expand Up @@ -231,7 +232,8 @@ Source dictionary from `../build/common.gypi`:
```
{
'include_dirs': ['include'], # Treated as relative to ../build
'libraries': ['-lz'], # Not treated as a pathname, begins with a dash
'library_dirs': ['lib'], # Treated as relative to ../build
'libraries': ['-lz'], # Not treated as a pathname, begins with a dash
'defines': ['NDEBUG'], # defines does not contain pathnames
}
```
Expand All @@ -250,6 +252,7 @@ Merged dictionary:
{
'sources': ['string_util.cc'],
'include_dirs': ['../build/include'],
'library_dirs': ['../build/lib'],
'libraries': ['-lz'],
'defines': ['NDEBUG'],
}
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/gyp_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# found in the LICENSE file.

import os
import sys
import subprocess
import sys


def IsCygwin():
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 @@ -4,7 +4,7 @@

"""Visual Studio project reader/writer."""

import gyp.easy_xml as easy_xml
from gyp import easy_xml

# ------------------------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/pylib/gyp/MSVSSettings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"""Unit tests for the MSVSSettings.py file."""

import unittest
import gyp.MSVSSettings as MSVSSettings

from io import StringIO

from gyp import MSVSSettings


class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/MSVSToolFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

"""Visual Studio project reader/writer."""

import gyp.easy_xml as easy_xml
from gyp import easy_xml


class Writer:
Expand Down
3 changes: 1 addition & 2 deletions tools/gyp/pylib/gyp/MSVSUserFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import re
import socket # for gethostname

import gyp.easy_xml as easy_xml

from gyp import easy_xml

# ------------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion tools/gyp/pylib/gyp/MSVSUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import copy
import os


# A dictionary mapping supported target types to extensions.
TARGET_TYPE_EXT = {
"executable": "exe",
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/pylib/gyp/MSVSVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"""Handle version information related to Visual Stuio."""

import errno
import glob
import os
import re
import subprocess
import sys
import glob


def JoinPath(*args):
Expand Down
29 changes: 14 additions & 15 deletions tools/gyp/pylib/gyp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
# found in the LICENSE file.

from __future__ import annotations
import copy
import gyp.input

import argparse
import copy
import os.path
import re
import shlex
import sys
import traceback
from gyp.common import GypError

import gyp.input
from gyp.common import GypError

# Default debug modes for GYP
debug = {}
Expand Down Expand Up @@ -205,8 +206,7 @@ def NameValueListToDict(name_value_list):


def ShlexEnv(env_name):
flags = os.environ.get(env_name, [])
if flags:
if flags := os.environ.get(env_name) or []:
flags = shlex.split(flags)
return flags

Expand Down Expand Up @@ -361,7 +361,7 @@ def gyp_main(args):
action="store",
env_name="GYP_CONFIG_DIR",
default=None,
help="The location for configuration files like " "include.gypi.",
help="The location for configuration files like include.gypi.",
)
parser.add_argument(
"-d",
Expand Down Expand Up @@ -525,19 +525,18 @@ def gyp_main(args):
# If no format was given on the command line, then check the env variable.
generate_formats = []
if options.use_environment:
generate_formats = os.environ.get("GYP_GENERATORS", [])
generate_formats = os.environ.get("GYP_GENERATORS") or []
if generate_formats:
generate_formats = re.split(r"[\s,]", generate_formats)
if generate_formats:
options.formats = generate_formats
# Nothing in the variable, default based on platform.
elif sys.platform == "darwin":
options.formats = ["xcode"]
elif sys.platform in ("win32", "cygwin"):
options.formats = ["msvs"]
else:
# Nothing in the variable, default based on platform.
if sys.platform == "darwin":
options.formats = ["xcode"]
elif sys.platform in ("win32", "cygwin"):
options.formats = ["msvs"]
else:
options.formats = ["make"]
options.formats = ["make"]

if not options.generator_output and options.use_environment:
g_o = os.environ.get("GYP_GENERATOR_OUTPUT")
Expand Down Expand Up @@ -696,7 +695,7 @@ def main(args):
return 1


# NOTE: setuptools generated console_scripts calls function with no arguments
# NOTE: console_scripts calls this function with no arguments
def script_main():
return main(sys.argv[1:])

Expand Down
8 changes: 3 additions & 5 deletions tools/gyp/pylib/gyp/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
import filecmp
import os.path
import re
import tempfile
import sys
import subprocess
import shlex

import subprocess
import sys
import tempfile
from collections.abc import MutableSet


Expand All @@ -35,7 +34,6 @@ class GypError(Exception):
to the user. The main entry point will catch and display this.
"""

pass


def ExceptionAppend(e, msg):
Expand Down
24 changes: 13 additions & 11 deletions tools/gyp/pylib/gyp/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

"""Unit tests for the common.py file."""

import gyp.common
import unittest
import sys
import os
from unittest.mock import patch, MagicMock
import sys
import unittest
from unittest.mock import MagicMock, patch

import gyp.common


class TestTopologicallySorted(unittest.TestCase):
def test_Valid(self):
Expand Down Expand Up @@ -109,30 +111,30 @@ def mock_run(env, defines_stdout, expected_cmd):
return [defines, flavor]

[defines1, _] = mock_run({}, "", [])
assert {} == defines1
assert defines1 == {}

[defines2, flavor2] = mock_run(
{ "CC_target": "/opt/wasi-sdk/bin/clang" },
"#define __wasm__ 1\n#define __wasi__ 1\n",
["/opt/wasi-sdk/bin/clang"]
)
assert { "__wasm__": "1", "__wasi__": "1" } == defines2
assert defines2 == { "__wasm__": "1", "__wasi__": "1" }
assert flavor2 == "wasi"

[defines3, flavor3] = mock_run(
{ "CC_target": "/opt/wasi-sdk/bin/clang --target=wasm32" },
"#define __wasm__ 1\n",
["/opt/wasi-sdk/bin/clang", "--target=wasm32"]
)
assert { "__wasm__": "1" } == defines3
assert defines3 == { "__wasm__": "1" }
assert flavor3 == "wasm"

[defines4, flavor4] = mock_run(
{ "CC_target": "/emsdk/upstream/emscripten/emcc" },
"#define __EMSCRIPTEN__ 1\n",
["/emsdk/upstream/emscripten/emcc"]
)
assert { "__EMSCRIPTEN__": "1" } == defines4
assert defines4 == { "__EMSCRIPTEN__": "1" }
assert flavor4 == "emscripten"

# Test path which include white space
Expand All @@ -149,11 +151,11 @@ def mock_run(env, defines_stdout, expected_cmd):
"-pthread"
]
)
assert {
assert defines5 == {
"__wasm__": "1",
"__wasi__": "1",
"_REENTRANT": "1"
} == defines5
}
assert flavor5 == "wasi"

original_sep = os.sep
Expand All @@ -164,7 +166,7 @@ def mock_run(env, defines_stdout, expected_cmd):
["C:/Program Files/wasi-sdk/clang.exe"]
)
os.sep = original_sep
assert { "__wasm__": "1", "__wasi__": "1" } == defines6
assert defines6 == { "__wasm__": "1", "__wasi__": "1" }
assert flavor6 == "wasi"

if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions tools/gyp/pylib/gyp/easy_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import sys
import re
import os
import locale
import os
import re
import sys
from functools import reduce


Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/pylib/gyp/easy_xml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

""" Unit tests for the easy_xml.py file. """

import gyp.easy_xml as easy_xml
import unittest

from io import StringIO

from gyp import easy_xml


class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
Expand Down
7 changes: 4 additions & 3 deletions tools/gyp/pylib/gyp/generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@
"""


import gyp.common
import json
import os
import posixpath

import gyp.common

debug = False

found_dependency_string = "Found dependency"
Expand Down Expand Up @@ -157,7 +158,7 @@ def _AddSources(sources, base_path, base_path_components, result):
and tracked in some other means."""
# NOTE: gyp paths are always posix style.
for source in sources:
if not len(source) or source.startswith("!!!") or source.startswith("$"):
if not len(source) or source.startswith(("!!!", "$")):
continue
# variable expansion may lead to //.
org_source = source
Expand Down Expand Up @@ -747,7 +748,7 @@ def GenerateOutput(target_list, target_dicts, data, params):

if not config.files:
raise Exception(
"Must specify files to analyze via config_path generator " "flag"
"Must specify files to analyze via config_path generator flag"
)

toplevel_dir = _ToGypPath(os.path.abspath(params["options"].toplevel_dir))
Expand Down
Loading
Loading