Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit c3c510d

Browse files
authored
gyp: update gyp to v0.8.0 (#2318)
PR-URL: #2318 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent cc1cbce commit c3c510d

44 files changed

Lines changed: 639 additions & 762 deletions

Some content is hidden

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

‎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 }}

‎gyp/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
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+
319
## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)
420

521

‎gyp/gyp_main.py‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@
88
importsys
99
importsubprocess
1010

11-
PY3=bytes!=str
12-
1311

1412
defIsCygwin():
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-
ifPY3:
22-
stdout=stdout.decode("utf-8")
23-
return"CYGWIN"instr(stdout)
18+
stdout, _=out.communicate()
19+
return"CYGWIN"instdout.decode("utf-8")
2420
exceptException:
2521
returnFalse
2622

@@ -33,9 +29,7 @@ def UnixifyPath(path):
3329
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
3430
)
3531
stdout, _=out.communicate()
36-
ifPY3:
37-
stdout=stdout.decode("utf-8")
38-
returnstr(stdout)
32+
returnstdout.decode("utf-8")
3933
exceptException:
4034
returnpath
4135

‎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
importgyp.common
1313

14-
try:
15-
cmp
16-
exceptNameError:
1714

18-
defcmp(x, y):
19-
return (x>y) - (x<y)
15+
defcmp(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-
classMSVSSolutionEntry(object):
69+
classMSVSSolutionEntry:
7370
def__cmp__(self, other):
7471
# Sort by name then guid (so things are in order on vs2008).
7572
returncmp((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-
classMSVSSolution(object):
190+
classMSVSSolution:
194191
"""Visual Studio solution."""
195192

196193
def__init__(
@@ -292,14 +289,14 @@ def Write(self, writer=gyp.common.WriteOnDiff):
292289
ife.items:
293290
f.write("\tProjectSection(SolutionItems) = preProject\r\n")
294291
foriine.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
ifisinstance(e, MSVSProject):
299296
ife.dependencies:
300297
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
301298
fordine.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
forvinself.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
ifnotisinstance(e, MSVSFolder):
363360
continue# Does not apply to projects, only folders
364361
forsubentryine.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‎

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

1111

12-
classTool(object):
12+
classTool:
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-
classFilter(object):
34+
classFilter:
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-
classWriter(object):
51+
classWriter:
5252
"""Visual Studio XML project writer."""
5353

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

‎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__ importprint_function
18-
19-
fromgypimportstring_types
20-
21-
importsys
2217
importre
18+
importsys
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
returnmsbuild_settings.setdefault(tool.msbuild_name, {})
6965

7066

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

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

112108
defValidateMSVS(self, value):
113-
ifnotisinstance(value, string_types):
109+
ifnotisinstance(value, str):
114110
raiseValueError("expected string; got %r"%value)
115111

116112
defValidateMSBuild(self, value):
117-
ifnotisinstance(value, string_types):
113+
ifnotisinstance(value, str):
118114
raiseValueError("expected string; got %r"%value)
119115

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

128124
defValidateMSVS(self, value):
129-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
125+
ifnotisinstance(value, (list, str)):
130126
raiseValueError("expected string list; got %r"%value)
131127

132128
defValidateMSBuild(self, value):
133-
ifnotisinstance(value, string_types) andnotisinstance(value, list):
129+
ifnotisinstance(value, (list, str)):
134130
raiseValueError("expected string list; got %r"%value)
135131

136132
defConvertToMSBuild(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(valueforvalueinlabel_listifvalueisnotNone)
194+
self._msbuild_values={valueforvalueinlabel_listifvalueisnotNone}
199195
ifnewisnotNone:
200196
self._msbuild_values.update(new)
201197

@@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
342338
ifvalue=="true":
343339
tool_settings=_GetMSBuildToolSettings(msbuild_settings, tool)
344340
if"AdditionalOptions"intool_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
exceptValueErrorase:
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‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
importunittest
1010
importgyp.MSVSSettingsasMSVSSettings
1111

12-
try:
13-
fromStringIOimportStringIO# Python 2
14-
exceptImportError:
15-
fromioimportStringIO# Python 3
12+
fromioimportStringIO
1613

1714

1815
classTestSequenceFunctions(unittest.TestCase):

‎gyp/pylib/gyp/MSVSToolFile.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importgyp.easy_xmlaseasy_xml
88

99

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

1313
def__init__(self, tool_file_path, name):

‎gyp/pylib/gyp/MSVSUserFile.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
5353
returnnew_args
5454

5555

56-
classWriter(object):
56+
classWriter:
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
ifenvironmentandisinstance(environment, dict):
96-
env_list= ['%s="%s"'% (key, val)for (key, val) inenvironment.items()]
96+
env_list= [f'{key}="{val}"'for (key, val) inenvironment.items()]
9797
environment=" ".join(env_list)
9898
else:
9999
environment=""

‎gyp/pylib/gyp/MSVSUtil.py‎

Lines changed: 2 additions & 2 deletions
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
returnpdb_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
returnpdb_path

0 commit comments

Comments
 (0)