Skip to content

Commit 083d8ff

Browse files
cclaussowl-from-hogvarts
authored andcommitted
gyp: update gyp to v0.8.0 (nodejs#2318)
PR-URL: nodejs#2318 Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Jiawen Geng <[email protected]>
1 parent 212e6f3 commit 083d8ff

Some content is hidden

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

44 files changed

+657
-753
lines changed

gyp/.github/workflows/Python_tests.yml

+2-3
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 }}

gyp/CHANGELOG.md

+35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Changelog
22

3+
## [0.8.0](https://www.github.com/nodejs/gyp-next/compare/v0.7.0...v0.8.0) (2021-01-15)
4+
5+
6+
### ⚠ BREAKING CHANGES
7+
8+
* remove support for Python 2
9+
10+
### Bug Fixes
11+
12+
* revert posix build job ([#86](https://www.github.com/nodejs/gyp-next/issues/86)) ([39dc34f](https://www.github.com/nodejs/gyp-next/commit/39dc34f0799c074624005fb9bbccf6e028607f9d))
13+
14+
15+
### gyp
16+
17+
* 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))
18+
19+
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
20+
21+
22+
### ⚠ BREAKING CHANGES
23+
24+
* **msvs:** On Windows, arguments passed to the "action" commands are no longer transformed to replace slashes with backslashes.
25+
26+
### Features
27+
28+
* **xcode:** --cross-compiling overrides arch-specific settings ([973bae0](https://www.github.com/nodejs/gyp-next/commit/973bae0b7b08be7b680ecae9565fbd04b3e0787d))
29+
30+
31+
### Bug Fixes
32+
33+
* **msvs:** do not fix paths in action command arguments ([fc22f83](https://www.github.com/nodejs/gyp-next/commit/fc22f8335e2016da4aae4f4233074bd651d2faea))
34+
* cmake on python 3 ([fd61f5f](https://www.github.com/nodejs/gyp-next/commit/fd61f5faa5275ec8fc98e3c7868c0dd46f109540))
35+
* ValueError: invalid mode: 'rU' while trying to load binding.gyp ([d0504e6](https://www.github.com/nodejs/gyp-next/commit/d0504e6700ce48f44957a4d5891b142a60be946f))
36+
* xcode cmake parsing ([eefe8d1](https://www.github.com/nodejs/gyp-next/commit/eefe8d10e99863bc4ac7e2ed32facd608d400d4b))
37+
338
### [0.6.2](https://www.github.com/nodejs/gyp-next/compare/v0.6.1...v0.6.2) (2020-10-16)
439

540

gyp/gyp_main.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -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

gyp/pylib/gyp/MSVSNew.py

+8-11
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")

gyp/pylib/gyp/MSVSProject.py

+3-3
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):

gyp/pylib/gyp/MSVSSettings.py

+11-15
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

gyp/pylib/gyp/MSVSSettings_test.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
import unittest
1010
import gyp.MSVSSettings as MSVSSettings
1111

12-
try:
13-
from StringIO import StringIO # Python 2
14-
except ImportError:
15-
from io import StringIO # Python 3
12+
from io import StringIO
1613

1714

1815
class TestSequenceFunctions(unittest.TestCase):

gyp/pylib/gyp/MSVSToolFile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import gyp.easy_xml as easy_xml
88

99

10-
class Writer(object):
10+
class Writer:
1111
"""Visual Studio XML tool file writer."""
1212

1313
def __init__(self, tool_file_path, name):

gyp/pylib/gyp/MSVSUserFile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
return new_args
5454

5555

56-
class Writer(object):
56+
class Writer:
5757
"""Visual Studio XML user user file writer."""
5858

5959
def __init__(self, user_file_path, version, name):
@@ -93,7 +93,7 @@ def AddDebugSettings(
9393
abs_command = _FindCommandInPath(command[0])
9494

9595
if environment and isinstance(environment, dict):
96-
env_list = ['%s="%s"' % (key, val) for (key, val) in environment.items()]
96+
env_list = [f'{key}="{val}"' for (key, val) in environment.items()]
9797
environment = " ".join(env_list)
9898
else:
9999
environment = ""

gyp/pylib/gyp/MSVSUtil.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def _SuffixName(name, suffix):
5555
Target name with suffix added (foo_suffix#target)
5656
"""
5757
parts = name.rsplit("#", 1)
58-
parts[0] = "%s_%s" % (parts[0], suffix)
58+
parts[0] = "{}_{}".format(parts[0], suffix)
5959
return "#".join(parts)
6060

6161

@@ -160,7 +160,7 @@ def _GetPdbPath(target_dict, config_name, vars):
160160
return pdb_path
161161

162162
pdb_base = target_dict.get("product_name", target_dict["target_name"])
163-
pdb_base = "%s.%s.pdb" % (pdb_base, TARGET_TYPE_EXT[target_dict["type"]])
163+
pdb_base = "{}.{}.pdb".format(pdb_base, TARGET_TYPE_EXT[target_dict["type"]])
164164
pdb_path = vars["PRODUCT_DIR"] + "/" + pdb_base
165165

166166
return pdb_path

0 commit comments

Comments
 (0)