Skip to content

Commit dccb23e

Browse files
tools: update gyp-next to 0.20.0
1 parent e57841f commit dccb23e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+631
-288
lines changed

tools/gyp/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,6 @@ cython_debug/
141141
# static files generated from Django application using `collectstatic`
142142
media
143143
static
144+
145+
test/fixtures/out
146+
*.actual

tools/gyp/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## [0.20.0](https://github.com/nodejs/gyp-next/compare/v0.19.1...v0.20.0) (2025-03-27)
4+
5+
6+
### ⚠ BREAKING CHANGES
7+
8+
* resolve issue with relative paths during linking ([#284](https://github.com/nodejs/gyp-next/issues/284))
9+
10+
### Bug Fixes
11+
12+
* python lint more ruff rules ([#291](https://github.com/nodejs/gyp-next/issues/291)) ([fabc78c](https://github.com/nodejs/gyp-next/commit/fabc78caffcf988365d970ced5a151f40525077e))
13+
* remove explicit installation of setuptools ([#278](https://github.com/nodejs/gyp-next/issues/278)) ([e476778](https://github.com/nodejs/gyp-next/commit/e4767782c70ca8427184694589d9f0ded5eeed22))
14+
* 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))
15+
316
## [0.19.1](https://github.com/nodejs/gyp-next/compare/v0.19.0...v0.19.1) (2024-12-09)
417

518

tools/gyp/docs/Hacking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ to make sure your changes aren't breaking anything important.
2424
You run the test driver with e.g.
2525

2626
``` sh
27-
$ python -m pip install --upgrade pip setuptools
27+
$ python -m pip install --upgrade pip
2828
$ pip install --editable ".[dev]"
2929
$ python -m pytest
3030
```

tools/gyp/docs/InputFormatReference.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ lists associated with the following keys, are treated as pathnames:
194194
* include\_dirs
195195
* inputs
196196
* libraries
197+
* library\_dirs
197198
* outputs
198199
* sources
199200
* mac\_bundle\_resources
@@ -231,7 +232,8 @@ Source dictionary from `../build/common.gypi`:
231232
```
232233
{
233234
'include_dirs': ['include'], # Treated as relative to ../build
234-
'libraries': ['-lz'], # Not treated as a pathname, begins with a dash
235+
'library_dirs': ['lib'], # Treated as relative to ../build
236+
'libraries': ['-lz'], # Not treated as a pathname, begins with a dash
235237
'defines': ['NDEBUG'], # defines does not contain pathnames
236238
}
237239
```
@@ -250,6 +252,7 @@ Merged dictionary:
250252
{
251253
'sources': ['string_util.cc'],
252254
'include_dirs': ['../build/include'],
255+
'library_dirs': ['../build/lib'],
253256
'libraries': ['-lz'],
254257
'defines': ['NDEBUG'],
255258
}

tools/gyp/gyp_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# found in the LICENSE file.
66

77
import os
8-
import sys
98
import subprocess
9+
import sys
1010

1111

1212
def IsCygwin():

tools/gyp/pylib/gyp/MSVSProject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
import gyp.easy_xml as easy_xml
7+
from gyp import easy_xml
88

99
# ------------------------------------------------------------------------------
1010

tools/gyp/pylib/gyp/MSVSSettings_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"""Unit tests for the MSVSSettings.py file."""
88

99
import unittest
10-
import gyp.MSVSSettings as MSVSSettings
11-
1210
from io import StringIO
1311

12+
from gyp import MSVSSettings
13+
1414

1515
class TestSequenceFunctions(unittest.TestCase):
1616
def setUp(self):

tools/gyp/pylib/gyp/MSVSToolFile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

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

7-
import gyp.easy_xml as easy_xml
7+
from gyp import easy_xml
88

99

1010
class Writer:

tools/gyp/pylib/gyp/MSVSUserFile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import re
99
import socket # for gethostname
1010

11-
import gyp.easy_xml as easy_xml
12-
11+
from gyp import easy_xml
1312

1413
# ------------------------------------------------------------------------------
1514

tools/gyp/pylib/gyp/MSVSUtil.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import copy
88
import os
99

10-
1110
# A dictionary mapping supported target types to extensions.
1211
TARGET_TYPE_EXT = {
1312
"executable": "exe",

tools/gyp/pylib/gyp/MSVSVersion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"""Handle version information related to Visual Stuio."""
66

77
import errno
8+
import glob
89
import os
910
import re
1011
import subprocess
1112
import sys
12-
import glob
1313

1414

1515
def JoinPath(*args):

tools/gyp/pylib/gyp/__init__.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
# found in the LICENSE file.
66

77
from __future__ import annotations
8-
import copy
9-
import gyp.input
8+
109
import argparse
10+
import copy
1111
import os.path
1212
import re
1313
import shlex
1414
import sys
1515
import traceback
16-
from gyp.common import GypError
1716

17+
import gyp.input
18+
from gyp.common import GypError
1819

1920
# Default debug modes for GYP
2021
debug = {}
@@ -205,8 +206,7 @@ def NameValueListToDict(name_value_list):
205206

206207

207208
def ShlexEnv(env_name):
208-
flags = os.environ.get(env_name, [])
209-
if flags:
209+
if flags := os.environ.get(env_name) or []:
210210
flags = shlex.split(flags)
211211
return flags
212212

@@ -361,7 +361,7 @@ def gyp_main(args):
361361
action="store",
362362
env_name="GYP_CONFIG_DIR",
363363
default=None,
364-
help="The location for configuration files like " "include.gypi.",
364+
help="The location for configuration files like include.gypi.",
365365
)
366366
parser.add_argument(
367367
"-d",
@@ -525,19 +525,18 @@ def gyp_main(args):
525525
# If no format was given on the command line, then check the env variable.
526526
generate_formats = []
527527
if options.use_environment:
528-
generate_formats = os.environ.get("GYP_GENERATORS", [])
528+
generate_formats = os.environ.get("GYP_GENERATORS") or []
529529
if generate_formats:
530530
generate_formats = re.split(r"[\s,]", generate_formats)
531531
if generate_formats:
532532
options.formats = generate_formats
533+
# Nothing in the variable, default based on platform.
534+
elif sys.platform == "darwin":
535+
options.formats = ["xcode"]
536+
elif sys.platform in ("win32", "cygwin"):
537+
options.formats = ["msvs"]
533538
else:
534-
# Nothing in the variable, default based on platform.
535-
if sys.platform == "darwin":
536-
options.formats = ["xcode"]
537-
elif sys.platform in ("win32", "cygwin"):
538-
options.formats = ["msvs"]
539-
else:
540-
options.formats = ["make"]
539+
options.formats = ["make"]
541540

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

698697

699-
# NOTE: setuptools generated console_scripts calls function with no arguments
698+
# NOTE: console_scripts calls this function with no arguments
700699
def script_main():
701700
return main(sys.argv[1:])
702701

tools/gyp/pylib/gyp/common.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
import filecmp
77
import os.path
88
import re
9-
import tempfile
10-
import sys
11-
import subprocess
129
import shlex
13-
10+
import subprocess
11+
import sys
12+
import tempfile
1413
from collections.abc import MutableSet
1514

1615

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

38-
pass
3937

4038

4139
def ExceptionAppend(e, msg):

tools/gyp/pylib/gyp/common_test.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

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

9-
import gyp.common
10-
import unittest
11-
import sys
129
import os
13-
from unittest.mock import patch, MagicMock
10+
import sys
11+
import unittest
12+
from unittest.mock import MagicMock, patch
13+
14+
import gyp.common
15+
1416

1517
class TestTopologicallySorted(unittest.TestCase):
1618
def test_Valid(self):
@@ -109,30 +111,30 @@ def mock_run(env, defines_stdout, expected_cmd):
109111
return [defines, flavor]
110112

111113
[defines1, _] = mock_run({}, "", [])
112-
assert {} == defines1
114+
assert defines1 == {}
113115

114116
[defines2, flavor2] = mock_run(
115117
{ "CC_target": "/opt/wasi-sdk/bin/clang" },
116118
"#define __wasm__ 1\n#define __wasi__ 1\n",
117119
["/opt/wasi-sdk/bin/clang"]
118120
)
119-
assert { "__wasm__": "1", "__wasi__": "1" } == defines2
121+
assert defines2 == { "__wasm__": "1", "__wasi__": "1" }
120122
assert flavor2 == "wasi"
121123

122124
[defines3, flavor3] = mock_run(
123125
{ "CC_target": "/opt/wasi-sdk/bin/clang --target=wasm32" },
124126
"#define __wasm__ 1\n",
125127
["/opt/wasi-sdk/bin/clang", "--target=wasm32"]
126128
)
127-
assert { "__wasm__": "1" } == defines3
129+
assert defines3 == { "__wasm__": "1" }
128130
assert flavor3 == "wasm"
129131

130132
[defines4, flavor4] = mock_run(
131133
{ "CC_target": "/emsdk/upstream/emscripten/emcc" },
132134
"#define __EMSCRIPTEN__ 1\n",
133135
["/emsdk/upstream/emscripten/emcc"]
134136
)
135-
assert { "__EMSCRIPTEN__": "1" } == defines4
137+
assert defines4 == { "__EMSCRIPTEN__": "1" }
136138
assert flavor4 == "emscripten"
137139

138140
# Test path which include white space
@@ -149,11 +151,11 @@ def mock_run(env, defines_stdout, expected_cmd):
149151
"-pthread"
150152
]
151153
)
152-
assert {
154+
assert defines5 == {
153155
"__wasm__": "1",
154156
"__wasi__": "1",
155157
"_REENTRANT": "1"
156-
} == defines5
158+
}
157159
assert flavor5 == "wasi"
158160

159161
original_sep = os.sep
@@ -164,7 +166,7 @@ def mock_run(env, defines_stdout, expected_cmd):
164166
["C:/Program Files/wasi-sdk/clang.exe"]
165167
)
166168
os.sep = original_sep
167-
assert { "__wasm__": "1", "__wasi__": "1" } == defines6
169+
assert defines6 == { "__wasm__": "1", "__wasi__": "1" }
168170
assert flavor6 == "wasi"
169171

170172
if __name__ == "__main__":

tools/gyp/pylib/gyp/easy_xml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5-
import sys
6-
import re
7-
import os
85
import locale
6+
import os
7+
import re
8+
import sys
99
from functools import reduce
1010

1111

tools/gyp/pylib/gyp/easy_xml_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

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

9-
import gyp.easy_xml as easy_xml
109
import unittest
11-
1210
from io import StringIO
1311

12+
from gyp import easy_xml
13+
1414

1515
class TestSequenceFunctions(unittest.TestCase):
1616
def setUp(self):

tools/gyp/pylib/gyp/generator/analyzer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@
6363
"""
6464

6565

66-
import gyp.common
6766
import json
6867
import os
6968
import posixpath
7069

70+
import gyp.common
71+
7172
debug = False
7273

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

748749
if not config.files:
749750
raise Exception(
750-
"Must specify files to analyze via config_path generator " "flag"
751+
"Must specify files to analyze via config_path generator flag"
751752
)
752753

753754
toplevel_dir = _ToGypPath(os.path.abspath(params["options"].toplevel_dir))

0 commit comments

Comments
 (0)