Skip to content

Commit ffdaf47

Browse files
committed
tools: update gyp-next to v0.9.1
PR-URL: #38867 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent bcf73d6 commit ffdaf47

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

+712
-801
lines changed

tools/gyp/.github/workflows/Python_tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# TODO: Enable os: windows-latest
2-
# TODO: Enable python-version: 3.5
32
# TODO: Enable pytest --doctest-modules
43

54
name: Python_tests
@@ -9,10 +8,10 @@ jobs:
98
runs-on: ${{ matrix.os }}
109
strategy:
1110
fail-fast: false
12-
max-parallel: 15
11+
max-parallel: 8
1312
matrix:
1413
os: [macos-latest, ubuntu-latest] # , windows-latest]
15-
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
14+
python-version: [3.6, 3.7, 3.8, 3.9]
1615
steps:
1716
- uses: actions/checkout@v2
1817
- name: Set up Python ${{ matrix.python-version }}

tools/gyp/.github/workflows/node-gyp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
with:
2020
repository: nodejs/node-gyp
2121
path: node-gyp
22-
- uses: actions/setup-node@v1
22+
- uses: actions/setup-node@v2
2323
with:
2424
node-version: 14.x
2525
- uses: actions/setup-python@v2

tools/gyp/.github/workflows/release-please.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- main
55

66
name: release-please
77
jobs:
88
release-please:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: GoogleCloudPlatform/release-please-action@v2.5.6
11+
- uses: GoogleCloudPlatform/release-please-action@v2
1212
with:
1313
token: ${{ secrets.GITHUB_TOKEN }}
1414
release-type: python

tools/gyp/CHANGELOG.md

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

3+
### [0.9.1](https://www.github.com/nodejs/gyp-next/compare/v0.9.0...v0.9.1) (2021-05-14)
4+
5+
6+
### Bug Fixes
7+
8+
* py lint ([3b6a8ee](https://www.github.com/nodejs/gyp-next/commit/3b6a8ee7a66193a8a6867eba9e1d2b70bdf04402))
9+
10+
## [0.9.0](https://www.github.com/nodejs/gyp-next/compare/v0.8.1...v0.9.0) (2021-05-13)
11+
12+
13+
### Features
14+
15+
* use LDFLAGS_host for host toolset ([#98](https://www.github.com/nodejs/gyp-next/issues/98)) ([bea5c7b](https://www.github.com/nodejs/gyp-next/commit/bea5c7bd67d6ad32acbdce79767a5481c70675a2))
16+
17+
18+
### Bug Fixes
19+
20+
* msvs.py: remove overindentation ([#102](https://www.github.com/nodejs/gyp-next/issues/102)) ([3f83e99](https://www.github.com/nodejs/gyp-next/commit/3f83e99056d004d9579ceb786e06b624ddc36529))
21+
* update gyp.el to change case to cl-case ([#93](https://www.github.com/nodejs/gyp-next/issues/93)) ([13d5b66](https://www.github.com/nodejs/gyp-next/commit/13d5b66aab35985af9c2fb1174fdc6e1c1407ecc))
22+
23+
### [0.8.1](https://www.github.com/nodejs/gyp-next/compare/v0.8.0...v0.8.1) (2021-02-18)
24+
25+
26+
### Bug Fixes
27+
28+
* update shebang lines from python to python3 ([#94](https://www.github.com/nodejs/gyp-next/issues/94)) ([a1b0d41](https://www.github.com/nodejs/gyp-next/commit/a1b0d4171a8049a4ab7a614202063dec332f2df4))
29+
30+
## [0.8.0](https://www.github.com/nodejs/gyp-next/compare/v0.7.0...v0.8.0) (2021-01-15)
31+
32+
33+
### ⚠ BREAKING CHANGES
34+
35+
* remove support for Python 2
36+
37+
### Bug Fixes
38+
39+
* revert posix build job ([#86](https://www.github.com/nodejs/gyp-next/issues/86)) ([39dc34f](https://www.github.com/nodejs/gyp-next/commit/39dc34f0799c074624005fb9bbccf6e028607f9d))
40+
41+
42+
### gyp
43+
44+
* Remove support for Python 2 ([#88](https://www.github.com/nodejs/gyp-next/issues/88)) ([22e4654](https://www.github.com/nodejs/gyp-next/commit/22e465426fd892403c95534229af819a99c3f8dc))
45+
346
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
447

548

tools/gyp/CODE_OF_CONDUCT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Code of Conduct
22

3-
* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
4-
* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md)
3+
* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md)
4+
* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/HEAD/Moderation-Policy.md)

tools/gyp/CONTRIBUTING.md

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

33
## Code of Conduct
44

5-
This project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md).
5+
This project is bound to the [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md).
66

77
<a id="developers-certificate-of-origin"></a>
88
## Developer's Certificate of Origin 1.1

tools/gyp/gyp_main.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
# Copyright (c) 2009 Google Inc. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
@@ -8,19 +8,15 @@
88
import sys
99
import subprocess
1010

11-
PY3 = bytes != str
12-
1311

1412
def IsCygwin():
1513
# Function copied from pylib/gyp/common.py
1614
try:
1715
out = subprocess.Popen(
1816
"uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
1917
)
20-
stdout, stderr = out.communicate()
21-
if PY3:
22-
stdout = stdout.decode("utf-8")
23-
return "CYGWIN" in str(stdout)
18+
stdout, _ = out.communicate()
19+
return "CYGWIN" in stdout.decode("utf-8")
2420
except Exception:
2521
return False
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _ = out.communicate()
36-
if PY3:
37-
stdout = stdout.decode("utf-8")
38-
return str(stdout)
32+
return stdout.decode("utf-8")
3933
except Exception:
4034
return path
4135

tools/gyp/pylib/gyp/MSVSNew.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@
1111

1212
import gyp.common
1313

14-
try:
15-
cmp
16-
except NameError:
1714

18-
def cmp(x, y):
19-
return (x > y) - (x < y)
15+
def cmp(x, y):
16+
return (x > y) - (x < y)
2017

2118

2219
# Initialize random number generator
@@ -69,7 +66,7 @@ def MakeGuid(name, seed="msvs_new"):
6966
# ------------------------------------------------------------------------------
7067

7168

72-
class MSVSSolutionEntry(object):
69+
class MSVSSolutionEntry:
7370
def __cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
@@ -190,7 +187,7 @@ def set_msbuild_toolset(self, msbuild_toolset):
190187
# ------------------------------------------------------------------------------
191188

192189

193-
class MSVSSolution(object):
190+
class MSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def __init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
if e.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
for i in e.items:
295-
f.write("\t\t%s = %s\r\n" % (i, i))
292+
f.write(f"\t\t{i} = {i}\r\n")
296293
f.write("\tEndProjectSection\r\n")
297294

298295
if isinstance(e, MSVSProject):
299296
if e.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
for d in e.dependencies:
302-
f.write("\t\t%s = %s\r\n" % (d.get_guid(), d.get_guid()))
299+
f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
303300
f.write("\tEndProjectSection\r\n")
304301

305302
f.write("EndProject\r\n")
@@ -310,7 +307,7 @@ def Write(self, writer=gyp.common.WriteOnDiff):
310307
# Configurations (variants)
311308
f.write("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n")
312309
for v in self.variants:
313-
f.write("\t\t%s = %s\r\n" % (v, v))
310+
f.write(f"\t\t{v} = {v}\r\n")
314311
f.write("\tEndGlobalSection\r\n")
315312

316313
# Sort config guids for easier diffing of solution changes.
@@ -362,7 +359,7 @@ def Write(self, writer=gyp.common.WriteOnDiff):
362359
if not isinstance(e, MSVSFolder):
363360
continue # Does not apply to projects, only folders
364361
for subentry in e.entries:
365-
f.write("\t\t%s = %s\r\n" % (subentry.get_guid(), e.get_guid()))
362+
f.write(f"\t\t{subentry.get_guid()} = {e.get_guid()}\r\n")
366363
f.write("\tEndGlobalSection\r\n")
367364

368365
f.write("EndGlobal\r\n")

tools/gyp/pylib/gyp/MSVSProject.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# ------------------------------------------------------------------------------
1010

1111

12-
class Tool(object):
12+
class Tool:
1313
"""Visual Studio tool."""
1414

1515
def __init__(self, name, attrs=None):
@@ -31,7 +31,7 @@ def _GetSpecification(self):
3131
return ["Tool", self._attrs]
3232

3333

34-
class Filter(object):
34+
class Filter:
3535
"""Visual Studio filter - that is, a virtual folder."""
3636

3737
def __init__(self, name, contents=None):
@@ -48,7 +48,7 @@ def __init__(self, name, contents=None):
4848
# ------------------------------------------------------------------------------
4949

5050

51-
class Writer(object):
51+
class Writer:
5252
"""Visual Studio XML project writer."""
5353

5454
def __init__(self, project_path, version, name, guid=None, platforms=None):

tools/gyp/pylib/gyp/MSVSSettings.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@
1414
MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
1515
"""
1616

17-
from __future__ import print_function
18-
19-
from gyp import string_types
20-
21-
import sys
2217
import re
18+
import sys
2319

2420
# Dictionaries of settings validators. The key is the tool name, the value is
2521
# a dictionary mapping setting names to validation functions.
@@ -36,7 +32,7 @@
3632
_msbuild_name_of_tool = {}
3733

3834

39-
class _Tool(object):
35+
class _Tool:
4036
"""Represents a tool used by MSVS or MSBuild.
4137
4238
Attributes:
@@ -68,7 +64,7 @@ def _GetMSBuildToolSettings(msbuild_settings, tool):
6864
return msbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

71-
class _Type(object):
67+
class _Type:
7268
"""Type of settings (Base class)."""
7369

7470
def ValidateMSVS(self, value):
@@ -110,11 +106,11 @@ class _String(_Type):
110106
"""A setting that's just a string."""
111107

112108
def ValidateMSVS(self, value):
113-
if not isinstance(value, string_types):
109+
if not isinstance(value, str):
114110
raise ValueError("expected string; got %r" % value)
115111

116112
def ValidateMSBuild(self, value):
117-
if not isinstance(value, string_types):
113+
if not isinstance(value, str):
118114
raise ValueError("expected string; got %r" % value)
119115

120116
def ConvertToMSBuild(self, value):
@@ -126,11 +122,11 @@ class _StringList(_Type):
126122
"""A settings that's a list of strings."""
127123

128124
def ValidateMSVS(self, value):
129-
if not isinstance(value, string_types) and not isinstance(value, list):
125+
if not isinstance(value, (list, str)):
130126
raise ValueError("expected string list; got %r" % value)
131127

132128
def ValidateMSBuild(self, value):
133-
if not isinstance(value, string_types) and not isinstance(value, list):
129+
if not isinstance(value, (list, str)):
134130
raise ValueError("expected string list; got %r" % value)
135131

136132
def ConvertToMSBuild(self, value):
@@ -195,7 +191,7 @@ class _Enumeration(_Type):
195191
def __init__(self, label_list, new=None):
196192
_Type.__init__(self)
197193
self._label_list = label_list
198-
self._msbuild_values = set(value for value in label_list if value is not None)
194+
self._msbuild_values = {value for value in label_list if value is not None}
199195
if new is not None:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
if value == "true":
343339
tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
344340
if "AdditionalOptions" in tool_settings:
345-
new_flags = "%s %s" % (tool_settings["AdditionalOptions"], flag)
341+
new_flags = "{} {}".format(tool_settings["AdditionalOptions"], flag)
346342
else:
347343
new_flags = flag
348344
tool_settings["AdditionalOptions"] = new_flags
@@ -536,14 +532,14 @@ def _ValidateSettings(validators, settings, stderr):
536532
tool_validators[setting](value)
537533
except ValueError as e:
538534
print(
539-
"Warning: for %s/%s, %s" % (tool_name, setting, e),
535+
f"Warning: for {tool_name}/{setting}, {e}",
540536
file=stderr,
541537
)
542538
else:
543539
_ValidateExclusionSetting(
544540
setting,
545541
tool_validators,
546-
("Warning: unrecognized setting %s/%s" % (tool_name, setting)),
542+
(f"Warning: unrecognized setting {tool_name}/{setting}"),
547543
stderr,
548544
)
549545

0 commit comments

Comments
 (0)