Skip to content

Commit

Permalink
gyp: update gyp to 0.6.1
Browse files Browse the repository at this point in the history
Closes: #2236
PR-URL: #2238
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
  • Loading branch information
rvagg committed Oct 15, 2020
1 parent 3e7f8cc commit ee6a837
Show file tree
Hide file tree
Showing 21 changed files with 210 additions and 243 deletions.
4 changes: 2 additions & 2 deletions gyp/.flake8
@@ -1,4 +1,4 @@
[flake8]
max-complexity = 10
max-complexity = 101
max-line-length = 88
extend-ignore = E203,C901,E501
extend-ignore = E203 # whitespace before ':' to agree with psf/black
2 changes: 1 addition & 1 deletion gyp/.github/workflows/Python_tests.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
max-parallel: 15
matrix:
os: [macos-latest, ubuntu-latest] # , windows-latest]
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
40 changes: 40 additions & 0 deletions gyp/.github/workflows/node-gyp.yml
@@ -0,0 +1,40 @@
name: node-gyp integration

on: [push, pull_request]

jobs:
test:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Clone gyp-next
uses: actions/checkout@v2
with:
path: gyp-next
- name: Clone nodejs/node-gyp
uses: actions/checkout@v2
with:
repository: nodejs/node-gyp
path: node-gyp
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
cd node-gyp
npm install --no-progress
- name: Replace gyp in node-gyp
shell: bash
run: |
rm -rf node-gyp/gyp
cp -r gyp-next node-gyp/gyp
- name: Run tests
run: |
cd node-gyp
npm test
2 changes: 1 addition & 1 deletion gyp/.github/workflows/nodejs-windows.yml
Expand Up @@ -6,7 +6,7 @@ jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Clone node-gyp
- name: Clone gyp-next
uses: actions/checkout@v2
with:
path: gyp-next
Expand Down
28 changes: 27 additions & 1 deletion gyp/CHANGELOG.md
Expand Up @@ -6,6 +6,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [0.6.1] - 2020-10-14

### Fixed
- Correctly rename object files for absolute paths in MSVS generator.

## [0.6.0] - 2020-10-13

### Added
- The Makefile generator will now output shared libraries directly to the product
directory on all platforms (previously only macOS).

## [0.5.0] - 2020-09-30

### Added
- Extended compile_commands_json generator to consider more file extensions than
just `c` and `cc`. `cpp` and `cxx` are now supported.
- Source files with duplicate basenames are now supported.

### Removed
- The `--no-duplicate-basename-check` option was removed.
- The `msvs_enable_marmasm` configuration option was removed in favor of
auto-inclusion of the "marmasm" sections for Windows on ARM.

## [0.4.0] - 2020-07-14

### Added
Expand Down Expand Up @@ -34,7 +57,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
with changes made over the years in Node.js and node-gyp.

[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.6.1...HEAD
[0.6.1]: https://github.com/nodejs/gyp-next/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/nodejs/gyp-next/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/nodejs/gyp-next/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
Expand Down
3 changes: 3 additions & 0 deletions gyp/README.md
Expand Up @@ -2,3 +2,6 @@ GYP can Generate Your Projects.
===================================

Documents are available at [gyp.gsrc.io](https://gyp.gsrc.io), or you can check out ```md-pages``` branch to read those documents offline.

__gyp-next__ is [released](https://github.com/nodejs/gyp-next/releases) to the [__Python Packaging Index__](https://pypi.org/project/gyp-next) (PyPI) and can be installed with the command:
* `python3 -m pip install gyp-next`
9 changes: 6 additions & 3 deletions gyp/pylib/gyp/MSVSSettings_test.py
Expand Up @@ -678,7 +678,8 @@ def testConvertToMSBuildSettings_warnings(self):
"MSBuild, index value (21) not in expected range [0, 3)",
"Warning: while converting VCCLCompilerTool/UsePrecompiledHeader to "
"MSBuild, index value (13) not in expected range [0, 3)",
"Warning: while converting VCCLCompilerTool/GeneratePreprocessedFile to "
"Warning: while converting "
"VCCLCompilerTool/GeneratePreprocessedFile to "
"MSBuild, value must be one of [0, 1, 2]; got 14",
"Warning: while converting VCLinkerTool/Driver to "
"MSBuild, index value (10) not in expected range [0, 4)",
Expand Down Expand Up @@ -1348,7 +1349,8 @@ def testConvertToMSBuildSettings_actual(self):
"EmbedManifest": "false",
"GenerateCatalogFiles": "true",
"InputResourceManifests": "asfsfdafs",
"ManifestResourceFile": "$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf",
"ManifestResourceFile":
"$(IntDir)\\$(TargetFileName).embed.manifest.resfdsf",
"OutputManifestFile": "$(TargetPath).manifestdfs",
"RegistrarScriptFile": "sdfsfd",
"ReplacementsFile": "sdffsd",
Expand Down Expand Up @@ -1532,7 +1534,8 @@ def testConvertToMSBuildSettings_actual(self):
"LinkIncremental": "",
},
"ManifestResourceCompile": {
"ResourceOutputFileName": "$(IntDir)$(TargetFileName).embed.manifest.resfdsf"
"ResourceOutputFileName":
"$(IntDir)$(TargetFileName).embed.manifest.resfdsf"
},
}
self.maxDiff = 9999 # on failure display a long diff
Expand Down
17 changes: 0 additions & 17 deletions gyp/pylib/gyp/__init__.py
Expand Up @@ -68,7 +68,6 @@ def Load(
params=None,
check=False,
circular_check=True,
duplicate_basename_check=True,
):
"""
Loads one or more specified build files.
Expand Down Expand Up @@ -156,7 +155,6 @@ def Load(
generator_input_info,
check,
circular_check,
duplicate_basename_check,
params["parallel"],
params["root_targets"],
)
Expand Down Expand Up @@ -431,20 +429,6 @@ def gyp_main(args):
regenerate=False,
help="don't check for circular relationships between files",
)
# --no-duplicate-basename-check disables the check for duplicate basenames
# in a static_library/shared_library project. Visual C++ 2008 generator
# doesn't support this configuration. Libtool on Mac also generates warnings
# when duplicate basenames are passed into Make generator on Mac.
# TODO(yukawa): Remove this option when these legacy generators are
# deprecated.
parser.add_argument(
"--no-duplicate-basename-check",
dest="duplicate_basename_check",
action="store_false",
default=True,
regenerate=False,
help="don't check for duplicate basenames",
)
parser.add_argument(
"--no-parallel",
action="store_true",
Expand Down Expand Up @@ -651,7 +635,6 @@ def gyp_main(args):
params,
options.check,
options.circular_check,
options.duplicate_basename_check,
)

# TODO(mark): Pass |data| for now because the generator needs a list of
Expand Down
24 changes: 15 additions & 9 deletions gyp/pylib/gyp/common.py
Expand Up @@ -352,10 +352,14 @@ class Writer(object):
"""Wrapper around file which only covers the target if it differs."""

def __init__(self):
# On Cygwin remove the "dir" argument because `C:` prefixed paths are treated as relative,
# consequently ending up with current dir "/cygdrive/c/..." being prefixed to those, which was
# obviously a non-existent path, for example: "/cygdrive/c/<some folder>/C:\<my win style abs path>".
# See https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp for more details
# On Cygwin remove the "dir" argument
# `C:` prefixed paths are treated as relative,
# consequently ending up with current dir "/cygdrive/c/..."
# being prefixed to those, which was
# obviously a non-existent path,
# for example: "/cygdrive/c/<some folder>/C:\<my win style abs path>".
# For more details see:
# https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp
base_temp_dir = "" if IsCygwin() else os.path.dirname(filename)
# Pick temporary file.
tmp_fd, self.tmp_path = tempfile.mkstemp(
Expand Down Expand Up @@ -391,13 +395,15 @@ def close(self):
# one.
os.unlink(self.tmp_path)
else:
# The new file is different from the old one, or there is no old one.
# The new file is different from the old one,
# or there is no old one.
# Rename the new file to the permanent name.
#
# tempfile.mkstemp uses an overly restrictive mode, resulting in a
# file that can only be read by the owner, regardless of the umask.
# There's no reason to not respect the umask here, which means that
# an extra hoop is required to fetch it and reset the new file's mode.
# There's no reason to not respect the umask here,
# which means that an extra hoop is required
# to fetch it and reset the new file's mode.
#
# No way to get the umask without setting a new one? Set a safe one
# and then set it back to the old value.
Expand All @@ -406,8 +412,8 @@ def close(self):
os.chmod(self.tmp_path, 0o666 & ~umask)
if sys.platform == "win32" and os.path.exists(filename):
# NOTE: on windows (but not cygwin) rename will not replace an
# existing file, so it must be preceded with a remove. Sadly there
# is no way to make the switch atomic.
# existing file, so it must be preceded with a remove.
# Sadly there is no way to make the switch atomic.
os.remove(filename)
os.rename(self.tmp_path, filename)
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/generator/android.py
Expand Up @@ -557,7 +557,7 @@ def WriteSources(self, spec, configs, extra_sources):
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory and
treating them as a genereated sources. Otherwise the Android build
treating them as a generated sources. Otherwise the Android build
rules won't pick them up.
Args:
Expand Down
4 changes: 2 additions & 2 deletions gyp/pylib/gyp/generator/compile_commands_json.py
Expand Up @@ -61,8 +61,8 @@ def AddCommandsForTarget(cwd, target, params, per_config_commands):
defines = ["-D" + s for s in defines]

# TODO(bnoordhuis) Handle generated source files.
sources = target.get("sources", [])
sources = [s for s in sources if s.endswith(".c") or s.endswith(".cc")]
extensions = (".c", ".cc", ".cpp", ".cxx")
sources = [s for s in target.get("sources", []) if s.endswith(extensions)]

def resolve(filename):
return os.path.abspath(os.path.join(cwd, filename))
Expand Down

0 comments on commit ee6a837

Please sign in to comment.