Skip to content

Commit

Permalink
tools: update gyp-next to v0.9.1
Browse files Browse the repository at this point in the history
PR-URL: #38867
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
gengjiawen committed Jun 3, 2021
1 parent bcf73d6 commit ffdaf47
Show file tree
Hide file tree
Showing 54 changed files with 712 additions and 801 deletions.
5 changes: 2 additions & 3 deletions tools/gyp/.github/workflows/Python_tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# TODO: Enable os: windows-latest
# TODO: Enable python-version: 3.5
# TODO: Enable pytest --doctest-modules

name: Python_tests
Expand All @@ -9,10 +8,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 15
max-parallel: 8
matrix:
os: [macos-latest, ubuntu-latest] # , windows-latest]
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion tools/gyp/.github/workflows/node-gyp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
repository: nodejs/node-gyp
path: node-gyp
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: 14.x
- uses: actions/setup-python@v2
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/.github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
on:
push:
branches:
- master
- main

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2.5.6
- uses: GoogleCloudPlatform/release-please-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: python
Expand Down
43 changes: 43 additions & 0 deletions tools/gyp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Changelog

### [0.9.1](https://www.github.com/nodejs/gyp-next/compare/v0.9.0...v0.9.1) (2021-05-14)


### Bug Fixes

* py lint ([3b6a8ee](https://www.github.com/nodejs/gyp-next/commit/3b6a8ee7a66193a8a6867eba9e1d2b70bdf04402))

## [0.9.0](https://www.github.com/nodejs/gyp-next/compare/v0.8.1...v0.9.0) (2021-05-13)


### Features

* use LDFLAGS_host for host toolset ([#98](https://www.github.com/nodejs/gyp-next/issues/98)) ([bea5c7b](https://www.github.com/nodejs/gyp-next/commit/bea5c7bd67d6ad32acbdce79767a5481c70675a2))


### Bug Fixes

* msvs.py: remove overindentation ([#102](https://www.github.com/nodejs/gyp-next/issues/102)) ([3f83e99](https://www.github.com/nodejs/gyp-next/commit/3f83e99056d004d9579ceb786e06b624ddc36529))
* update gyp.el to change case to cl-case ([#93](https://www.github.com/nodejs/gyp-next/issues/93)) ([13d5b66](https://www.github.com/nodejs/gyp-next/commit/13d5b66aab35985af9c2fb1174fdc6e1c1407ecc))

### [0.8.1](https://www.github.com/nodejs/gyp-next/compare/v0.8.0...v0.8.1) (2021-02-18)


### Bug Fixes

* update shebang lines from python to python3 ([#94](https://www.github.com/nodejs/gyp-next/issues/94)) ([a1b0d41](https://www.github.com/nodejs/gyp-next/commit/a1b0d4171a8049a4ab7a614202063dec332f2df4))

## [0.8.0](https://www.github.com/nodejs/gyp-next/compare/v0.7.0...v0.8.0) (2021-01-15)


### ⚠ BREAKING CHANGES

* remove support for Python 2

### Bug Fixes

* revert posix build job ([#86](https://www.github.com/nodejs/gyp-next/issues/86)) ([39dc34f](https://www.github.com/nodejs/gyp-next/commit/39dc34f0799c074624005fb9bbccf6e028607f9d))


### gyp

* 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))

## [0.7.0](https://www.github.com/nodejs/gyp-next/compare/v0.6.2...v0.7.0) (2020-12-17)


Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code of Conduct

* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/master/Moderation-Policy.md)
* [Node.js Code of Conduct](https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md)
* [Node.js Moderation Policy](https://github.com/nodejs/admin/blob/HEAD/Moderation-Policy.md)
2 changes: 1 addition & 1 deletion tools/gyp/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Code of Conduct

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

<a id="developers-certificate-of-origin"></a>
## Developer's Certificate of Origin 1.1
Expand Down
14 changes: 4 additions & 10 deletions tools/gyp/gyp_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

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

PY3 = bytes != str


def IsCygwin():
# Function copied from pylib/gyp/common.py
try:
out = subprocess.Popen(
"uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
stdout, stderr = out.communicate()
if PY3:
stdout = stdout.decode("utf-8")
return "CYGWIN" in str(stdout)
stdout, _ = out.communicate()
return "CYGWIN" in stdout.decode("utf-8")
except Exception:
return False

Expand All @@ -33,9 +29,7 @@ def UnixifyPath(path):
["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
stdout, _ = out.communicate()
if PY3:
stdout = stdout.decode("utf-8")
return str(stdout)
return stdout.decode("utf-8")
except Exception:
return path

Expand Down
19 changes: 8 additions & 11 deletions tools/gyp/pylib/gyp/MSVSNew.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@

import gyp.common

try:
cmp
except NameError:

def cmp(x, y):
return (x > y) - (x < y)
def cmp(x, y):
return (x > y) - (x < y)


# Initialize random number generator
Expand Down Expand Up @@ -69,7 +66,7 @@ def MakeGuid(name, seed="msvs_new"):
# ------------------------------------------------------------------------------


class MSVSSolutionEntry(object):
class MSVSSolutionEntry:
def __cmp__(self, other):
# Sort by name then guid (so things are in order on vs2008).
return cmp((self.name, self.get_guid()), (other.name, other.get_guid()))
Expand Down Expand Up @@ -190,7 +187,7 @@ def set_msbuild_toolset(self, msbuild_toolset):
# ------------------------------------------------------------------------------


class MSVSSolution(object):
class MSVSSolution:
"""Visual Studio solution."""

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

if isinstance(e, MSVSProject):
if e.dependencies:
f.write("\tProjectSection(ProjectDependencies) = postProject\r\n")
for d in e.dependencies:
f.write("\t\t%s = %s\r\n" % (d.get_guid(), d.get_guid()))
f.write(f"\t\t{d.get_guid()} = {d.get_guid()}\r\n")
f.write("\tEndProjectSection\r\n")

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

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

f.write("EndGlobal\r\n")
Expand Down
6 changes: 3 additions & 3 deletions tools/gyp/pylib/gyp/MSVSProject.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# ------------------------------------------------------------------------------


class Tool(object):
class Tool:
"""Visual Studio tool."""

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


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

def __init__(self, name, contents=None):
Expand All @@ -48,7 +48,7 @@ def __init__(self, name, contents=None):
# ------------------------------------------------------------------------------


class Writer(object):
class Writer:
"""Visual Studio XML project writer."""

def __init__(self, project_path, version, name, guid=None, platforms=None):
Expand Down
26 changes: 11 additions & 15 deletions tools/gyp/pylib/gyp/MSVSSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
MSBuild install directory, e.g. c:\Program Files (x86)\MSBuild
"""

from __future__ import print_function

from gyp import string_types

import sys
import re
import sys

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


class _Tool(object):
class _Tool:
"""Represents a tool used by MSVS or MSBuild.
Attributes:
Expand Down Expand Up @@ -68,7 +64,7 @@ def _GetMSBuildToolSettings(msbuild_settings, tool):
return msbuild_settings.setdefault(tool.msbuild_name, {})


class _Type(object):
class _Type:
"""Type of settings (Base class)."""

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

def ValidateMSVS(self, value):
if not isinstance(value, string_types):
if not isinstance(value, str):
raise ValueError("expected string; got %r" % value)

def ValidateMSBuild(self, value):
if not isinstance(value, string_types):
if not isinstance(value, str):
raise ValueError("expected string; got %r" % value)

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

def ValidateMSVS(self, value):
if not isinstance(value, string_types) and not isinstance(value, list):
if not isinstance(value, (list, str)):
raise ValueError("expected string list; got %r" % value)

def ValidateMSBuild(self, value):
if not isinstance(value, string_types) and not isinstance(value, list):
if not isinstance(value, (list, str)):
raise ValueError("expected string list; got %r" % value)

def ConvertToMSBuild(self, value):
Expand Down Expand Up @@ -195,7 +191,7 @@ class _Enumeration(_Type):
def __init__(self, label_list, new=None):
_Type.__init__(self)
self._label_list = label_list
self._msbuild_values = set(value for value in label_list if value is not None)
self._msbuild_values = {value for value in label_list if value is not None}
if new is not None:
self._msbuild_values.update(new)

Expand Down Expand Up @@ -342,7 +338,7 @@ def _Translate(value, msbuild_settings):
if value == "true":
tool_settings = _GetMSBuildToolSettings(msbuild_settings, tool)
if "AdditionalOptions" in tool_settings:
new_flags = "%s %s" % (tool_settings["AdditionalOptions"], flag)
new_flags = "{} {}".format(tool_settings["AdditionalOptions"], flag)
else:
new_flags = flag
tool_settings["AdditionalOptions"] = new_flags
Expand Down Expand Up @@ -536,14 +532,14 @@ def _ValidateSettings(validators, settings, stderr):
tool_validators[setting](value)
except ValueError as e:
print(
"Warning: for %s/%s, %s" % (tool_name, setting, e),
f"Warning: for {tool_name}/{setting}, {e}",
file=stderr,
)
else:
_ValidateExclusionSetting(
setting,
tool_validators,
("Warning: unrecognized setting %s/%s" % (tool_name, setting)),
(f"Warning: unrecognized setting {tool_name}/{setting}"),
stderr,
)

Expand Down
7 changes: 2 additions & 5 deletions tools/gyp/pylib/gyp/MSVSSettings_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
Expand All @@ -9,10 +9,7 @@
import unittest
import gyp.MSVSSettings as MSVSSettings

try:
from StringIO import StringIO # Python 2
except ImportError:
from io import StringIO # Python 3
from io import StringIO


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


class Writer(object):
class Writer:
"""Visual Studio XML tool file writer."""

def __init__(self, tool_file_path, name):
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/pylib/gyp/MSVSUserFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _QuoteWin32CommandLineArgs(args):
return new_args


class Writer(object):
class Writer:
"""Visual Studio XML user user file writer."""

def __init__(self, user_file_path, version, name):
Expand Down Expand Up @@ -93,7 +93,7 @@ def AddDebugSettings(
abs_command = _FindCommandInPath(command[0])

if environment and isinstance(environment, dict):
env_list = ['%s="%s"' % (key, val) for (key, val) in environment.items()]
env_list = [f'{key}="{val}"' for (key, val) in environment.items()]
environment = " ".join(env_list)
else:
environment = ""
Expand Down
Loading

0 comments on commit ffdaf47

Please sign in to comment.