diff options
author | Darcy Clarke <darcy@darcyclarke.me> | 2020-10-15 22:36:10 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-10-16 02:10:52 +0300 |
commit | 120e6273604f15a2ce55668dfb2c23d06bf1e06c (patch) | |
tree | cc74206e14f1c1177d5a746973ab9b3b4e658313 /node_modules/node-gyp | |
parent | 2ccb63659f9a757201658d5d019099b492d04a5b (diff) |
node-gyp@7.1.1
Diffstat (limited to 'node_modules/node-gyp')
42 files changed, 298 insertions, 1770 deletions
diff --git a/node_modules/node-gyp/.github/workflows/Python_tests.yml b/node_modules/node-gyp/.github/workflows/Python_tests.yml deleted file mode 100644 index 067294515..000000000 --- a/node_modules/node-gyp/.github/workflows/Python_tests.yml +++ /dev/null @@ -1,40 +0,0 @@ -# TODO: Line 15, enable python-version: 3.5 -# TODO: Line 36, enable pytest --doctest-modules - -name: Python_tests -on: [push, pull_request] -jobs: - Python_tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 15 - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - python-version: [2.7, 3.6, 3.7, 3.8] # 3.5, - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest # -r requirements.txt - - name: Lint with flake8 - if: matrix.os == 'ubuntu-latest' - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest (Linux and macOS) - if: matrix.os != 'windows-latest' - run: pytest - - name: Test with pytest (Windows) - if: matrix.os == 'windows-latest' - shell: bash - run: GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" pytest - # - name: Run doctests with pytest - # run: pytest --doctest-modules diff --git a/node_modules/node-gyp/.github/workflows/tests.yml b/node_modules/node-gyp/.github/workflows/tests.yml new file mode 100644 index 000000000..651b1a9f4 --- /dev/null +++ b/node_modules/node-gyp/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +# TODO: Line 47, enable pytest --doctest-modules + +name: Tests +on: [push, pull_request] +jobs: + Tests: + strategy: + fail-fast: false + max-parallel: 15 + matrix: + node: [10.x, 12.x, 14.x] + python: [3.6, 3.8, 3.9] + os: [macos-latest, ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - name: Use Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + env: + PYTHON_VERSION: ${{ matrix.python }} + - name: Install Dependencies + run: | + npm install --no-progress + pip install flake8 pytest + - name: Set Windows environment + if: matrix.os == 'windows-latest' + run: + echo '::set-env name=GYP_MSVS_VERSION::2015' + echo '::set-env name=GYP_MSVS_OVERRIDE_PATH::C:\\Dummy' + - name: Lint Python + if: matrix.os == 'ubuntu-latest' + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Run Python tests + run: | + python -m pytest + # - name: Run doctests with pytest + # run: python -m pytest --doctest-modules + - name: Run Node tests + run: | + npm test diff --git a/node_modules/node-gyp/.travis.yml b/node_modules/node-gyp/.travis.yml deleted file mode 100644 index ae691bed4..000000000 --- a/node_modules/node-gyp/.travis.yml +++ /dev/null @@ -1,93 +0,0 @@ -dist: xenial -language: python -cache: pip -addons: - homebrew: - update: true - packages: - - npm - - pyenv -jobs: - include: - - name: "Python 2.7 on Linux" - env: NODE_GYP_FORCE_PYTHON=python2 - python: 2.7 - - - name: "Node.js 10 & Python 3.8 on Linux" - python: 3.8 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 10 - - - name: "Node.js 12 & Python 3.5 on Linux" - python: 3.5 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - name: "Node.js 12 & Python 3.6 on Linux" - python: 3.6 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - name: "Node.js 12 & Python 3.7 on Linux" - python: 3.7 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - name: "Node.js 12 & Python 3.8 on Linux" - python: 3.8 - env: NODE_GYP_FORCE_PYTHON=python3 - before_install: nvm install 12 - - - name: "Python 2.7 on macOS" - os: osx - osx_image: xcode11.2 - language: shell # 'language: python' is not yet supported on macOS - env: NODE_GYP_FORCE_PYTHON=python2 PATH=$HOME/.pyenv/shims:$PATH PYENV_VERSION=2.7.17 - before_install: pyenv install $PYENV_VERSION - - name: "Python 3.8 on macOS" - os: osx - osx_image: xcode11.2 - language: shell # 'language: python' is not yet supported on macOS - env: NODE_GYP_FORCE_PYTHON=python3 PATH=$HOME/.pyenv/shims:$PATH PYENV_VERSION=3.8.0 - before_install: pyenv install $PYENV_VERSION - - - name: "Node.js 12 & Python 2.7 on Windows" - os: windows - language: node_js - node_js: 12 # node - env: >- - PATH=/c/Python27:/c/Python27/Scripts:$PATH - NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe - before_install: choco install python2 - - - name: "Node.js 12 & Python 3.7 on Windows" - os: windows - language: node_js - node_js: 12 # node - env: >- - PATH=/c/Python37:/c/Python37/Scripts:$PATH - NODE_GYP_FORCE_PYTHON=/c/Python37/python.exe - before_install: choco install python --version=3.7.4 - - name: "Node.js 12 & Python 3.8 on Windows" - os: windows - language: node_js - node_js: 12 # node - env: >- - PATH=/c/Python38:/c/Python38/Scripts:$PATH - NODE_GYP_FORCE_PYTHON=/c/Python38/python.exe - before_install: choco install python - -install: - - python -m pip install --upgrade flake8 pytest==4.6.6 # pytest 5 no longer supports legacy Python -before_script: - - python -m flake8 --version - # stop the build if there are Python syntax errors or undefined names - - python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. Two space indentation is OK. The GitHub editor is 127 chars wide - - python -m flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics - - npm install - - npm list -script: - - node -e 'require("npmlog").level="verbose"; require("./lib/find-python")(null,()=>{})' - - npm test - - GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" python -m pytest -notifications: - on_success: change - on_failure: change # `always` will be the setting once code changes slow down diff --git a/node_modules/node-gyp/CHANGELOG.md b/node_modules/node-gyp/CHANGELOG.md index 2605d61fb..dd357e32f 100644 --- a/node_modules/node-gyp/CHANGELOG.md +++ b/node_modules/node-gyp/CHANGELOG.md @@ -1,3 +1,21 @@ +v7.1.1 2020-10-15 +================= + +This release restores the location of shared library builds to the pre-v7 +location. In v7.0.0 until this release, shared library outputs were placed +in a lib.target subdirectory inside the build/{Release,Debug} directory for +builds using `make` (Linux, etc.). This is inconsistent with macOS (Xcode) +behavior and previous node-gyp behavior so has been reverted. +We consider this a bug-fix rather than semver-major change. + +* [[`18bf2d1d38`](https://github.com/nodejs/node-gyp/commit/18bf2d1d38)] - **deps**: update deps to match npm@7 (Rod Vagg) [#2240](https://github.com/nodejs/node-gyp/pull/2240) +* [[`ee6a837cb7`](https://github.com/nodejs/node-gyp/commit/ee6a837cb7)] - **gyp**: update gyp to 0.6.1 (Rod Vagg) [#2238](https://github.com/nodejs/node-gyp/pull/2238) +* [[`3e7f8ccafc`](https://github.com/nodejs/node-gyp/commit/3e7f8ccafc)] - **lib**: better log message when ps fails (Martin Midtgaard) [#2229](https://github.com/nodejs/node-gyp/pull/2229) +* [[`7fb314339f`](https://github.com/nodejs/node-gyp/commit/7fb314339f)] - **test**: GitHub Actions: Test on Python 3.9 (Christian Clauss) [#2230](https://github.com/nodejs/node-gyp/pull/2230) +* [[`754996b9ec`](https://github.com/nodejs/node-gyp/commit/754996b9ec)] - **doc**: replace status badges with new Actions badge (Rod Vagg) [#2218](https://github.com/nodejs/node-gyp/pull/2218) +* [[`2317dc400c`](https://github.com/nodejs/node-gyp/commit/2317dc400c)] - **ci**: switch to GitHub Actions (Shelley Vohr) [#2210](https://github.com/nodejs/node-gyp/pull/2210) +* [[`2cca9b74f7`](https://github.com/nodejs/node-gyp/commit/2cca9b74f7)] - **doc**: drop the --production flag for installing windows-build-tools (DeeDeeG) [#2206](https://github.com/nodejs/node-gyp/pull/2206) + v7.1.0 2020-08-12 ================= diff --git a/node_modules/node-gyp/README.md b/node_modules/node-gyp/README.md index fd7e6a117..e06b01a73 100644 --- a/node_modules/node-gyp/README.md +++ b/node_modules/node-gyp/README.md @@ -1,7 +1,6 @@ # `node-gyp` - Node.js native addon build tool -[![Travis CI](https://travis-ci.com/nodejs/node-gyp.svg?branch=master)](https://travis-ci.com/nodejs/node-gyp) -[![Build Status](https://github.com/nodejs/node-gyp/workflows/Python_tests/badge.svg)](https://github.com/nodejs/node-gyp/actions?workflow=Python_tests) +[![Build Status](https://github.com/nodejs/node-gyp/workflows/Tests/badge.svg?branch=master)](https://github.com/nodejs/node-gyp/actions?query=workflow%3ATests+branch%3Amaster) `node-gyp` is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. It contains a vendored copy of the @@ -49,7 +48,7 @@ Install the current version of Python from the [Microsoft Store package](https:/ #### Option 1 -Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). +Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). #### Option 2 diff --git a/node_modules/node-gyp/gyp/.flake8 b/node_modules/node-gyp/gyp/.flake8 index 139e952e7..ea0c7680e 100644 --- a/node_modules/node-gyp/gyp/.flake8 +++ b/node_modules/node-gyp/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 diff --git a/node_modules/node-gyp/gyp/.github/workflows/Python_tests.yml b/node_modules/node-gyp/gyp/.github/workflows/Python_tests.yml index a93b92f42..128654f31 100644 --- a/node_modules/node-gyp/gyp/.github/workflows/Python_tests.yml +++ b/node_modules/node-gyp/gyp/.github/workflows/Python_tests.yml @@ -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 }} diff --git a/node_modules/node-gyp/gyp/.github/workflows/node-gyp.yml b/node_modules/node-gyp/gyp/.github/workflows/node-gyp.yml new file mode 100644 index 000000000..78fe502bd --- /dev/null +++ b/node_modules/node-gyp/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 diff --git a/node_modules/node-gyp/gyp/.github/workflows/nodejs-windows.yml b/node_modules/node-gyp/gyp/.github/workflows/nodejs-windows.yml index 48a42372c..fffe96e33 100644 --- a/node_modules/node-gyp/gyp/.github/workflows/nodejs-windows.yml +++ b/node_modules/node-gyp/gyp/.github/workflows/nodejs-windows.yml @@ -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 diff --git a/node_modules/node-gyp/gyp/CHANGELOG.md b/node_modules/node-gyp/gyp/CHANGELOG.md index 8cbcdd3b7..ea632d388 100644 --- a/node_modules/node-gyp/gyp/CHANGELOG.md +++ b/node_modules/node-gyp/gyp/CHANGELOG.md @@ -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 @@ -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 diff --git a/node_modules/node-gyp/gyp/README.md b/node_modules/node-gyp/gyp/README.md index c0d73ac95..9ffc2b21e 100644 --- a/node_modules/node-gyp/gyp/README.md +++ b/node_modules/node-gyp/gyp/README.md @@ -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` diff --git a/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py b/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py index c53c88e82..99860c880 100755 --- a/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py @@ -678,7 +678,8 @@ class TestSequenceFunctions(unittest.TestCase): "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)", @@ -1348,7 +1349,8 @@ class TestSequenceFunctions(unittest.TestCase): "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", @@ -1532,7 +1534,8 @@ class TestSequenceFunctions(unittest.TestCase): "LinkIncremental": "", }, "ManifestResourceCompile": { - "ResourceOutputFileName": "$(IntDir)$(TargetFileName).embed.manifest.resfdsf" + "ResourceOutputFileName": + "$(IntDir)$(TargetFileName).embed.manifest.resfdsf" }, } self.maxDiff = 9999 # on failure display a long diff diff --git a/node_modules/node-gyp/gyp/pylib/gyp/__init__.py b/node_modules/node-gyp/gyp/pylib/gyp/__init__.py index e24953642..f6ea625d4 100755 --- a/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/__init__.py @@ -68,7 +68,6 @@ def Load( params=None, check=False, circular_check=True, - duplicate_basename_check=True, ): """ Loads one or more specified build files. @@ -156,7 +155,6 @@ def Load( generator_input_info, check, circular_check, - duplicate_basename_check, params["parallel"], params["root_targets"], ) @@ -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", @@ -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 diff --git a/node_modules/node-gyp/gyp/pylib/gyp/common.py b/node_modules/node-gyp/gyp/pylib/gyp/common.py index bfe546f86..a91564386 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/common.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/common.py @@ -352,10 +352,14 @@ def WriteOnDiff(filename): """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( @@ -391,13 +395,15 @@ def WriteOnDiff(filename): # 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. @@ -406,8 +412,8 @@ def WriteOnDiff(filename): 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: diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py index 3ac61008b..16728847c 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py @@ -557,7 +557,7 @@ class AndroidMkWriter(object): 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: diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py index 9bc21ff83..f330a04de 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py @@ -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)) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py index 6e1c5205c..d163ae313 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py @@ -30,7 +30,6 @@ import gyp import gyp.common import gyp.xcode_emulation from gyp.common import GetEnvironFallback -from gyp.common import GypError import hashlib @@ -177,7 +176,7 @@ cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) -""" +""" # noqa: E501 LINK_COMMANDS_MAC = """\ quiet_cmd_alink = LIBTOOL-STATIC $@ @@ -191,7 +190,7 @@ cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" +""" # noqa: E501 LINK_COMMANDS_ANDROID = """\ quiet_cmd_alink = AR($(TOOLSET)) $@ @@ -218,7 +217,7 @@ quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) quiet_cmd_solink_module_host = SOLINK_MODULE($(TOOLSET)) $@ cmd_solink_module_host = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" +""" # noqa: E501 LINK_COMMANDS_AIX = """\ @@ -236,7 +235,7 @@ cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -""" +""" # noqa: E501 LINK_COMMANDS_OS390 = """\ @@ -254,8 +253,7 @@ cmd_solink = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(LD_ quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ cmd_solink_module = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) -Wl,DLL - -""" +""" # noqa: E501 # Header of toplevel Makefile. @@ -404,7 +402,7 @@ quiet_cmd_copy = COPY $@ cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp %(copy_archive_args)s "$<" "$@") %(link_commands)s -""" +""" # noqa: E501 r""" # Define an escape_quotes function to escape single quotes. # This allows us to handle quotes properly as long as we always use @@ -503,7 +501,7 @@ endef .PHONY: FORCE_DO_CMD FORCE_DO_CMD: -""" +""" # noqa: E501 ) SHARED_HEADER_MAC_COMMANDS = """ @@ -534,7 +532,7 @@ cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) quiet_cmd_infoplist = INFOPLIST $@ cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" -""" +""" # noqa: E501 def WriteRootHeaderSuffixRules(writer): @@ -672,43 +670,6 @@ def SourceifyAndQuoteSpaces(path): return QuoteSpaces(Sourceify(path)) -# TODO: Avoid code duplication with _ValidateSourcesForMSVSProject in msvs.py. -def _ValidateSourcesForOSX(spec, all_sources): - """Makes sure if duplicate basenames are not specified in the source list. - - Arguments: - spec: The target dictionary containing the properties of the target. - """ - if spec.get("type", None) != "static_library": - return - - basenames = {} - for source in all_sources: - name, ext = os.path.splitext(source) - is_compiled_file = ext in [".c", ".cc", ".cpp", ".cxx", ".m", ".mm", ".s", ".S"] - if not is_compiled_file: - continue - basename = os.path.basename(name) # Don't include extension. - basenames.setdefault(basename, []).append(source) - - error = "" - for basename, files in basenames.items(): - if len(files) > 1: - error += " %s: %s\n" % (basename, " ".join(files)) - - if error: - print( - ( - "static library %s has several files with the same basename:\n" - % spec["target_name"] - ) - + error - + "libtool on OS X will generate" - + " warnings for them." - ) - raise GypError("Duplicate basenames in sources section, see list above") - - # Map from qualified target to path to output. target_outputs = {} # Map from qualified target to any linkable output. A subset @@ -867,10 +828,6 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD # Sources. all_sources = spec.get("sources", []) + extra_sources if all_sources: - if self.flavor == "mac": - # libtool on OS X generates warnings for duplicate basenames in the same - # target. - _ValidateSourcesForOSX(spec, all_sources) self.WriteSources( configs, deps, @@ -1342,7 +1299,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD ) if self.flavor == "mac": - cflags = self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform')) + cflags = self.xcode_settings.GetCflags( + configname, + arch=config.get('xcode_configuration_platform') + ) cflags_c = self.xcode_settings.GetCflagsC(configname) cflags_cc = self.xcode_settings.GetCflagsCC(configname) cflags_objc = self.xcode_settings.GetCflagsObjC(configname) @@ -1659,12 +1619,10 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD ldflags = config.get("ldflags", []) # Compute an rpath for this output if needed. if any(dep.endswith(".so") or ".so." in dep for dep in deps): - # We want to get the literal string "$ORIGIN" into the link command, - # so we need lots of escaping. - ldflags.append(r"-Wl,-rpath=\$$ORIGIN/lib.%s/" % self.toolset) - ldflags.append( - r"-Wl,-rpath-link=\$(builddir)/lib.%s/" % self.toolset - ) + # We want to get the literal string "$ORIGIN" + # into the link command, so we need lots of escaping. + ldflags.append(r"-Wl,-rpath=\$$ORIGIN/") + ldflags.append(r"-Wl,-rpath-link=\$(builddir)/") library_dirs = config.get("library_dirs", []) ldflags += [("-L%s" % library_dir) for library_dir in library_dirs] self.WriteList(ldflags, "LDFLAGS_%s" % configname) @@ -2212,14 +2170,16 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD def _InstallableTargetInstallPath(self): """Returns the location of the final output for an installable target.""" + # Functionality removed for all platforms to match Xcode and hoist + # shared libraries into PRODUCT_DIR for users: # Xcode puts shared_library results into PRODUCT_DIR, and some gyp files # rely on this. Emulate this behavior for mac. - if self.type == "shared_library" and ( - self.flavor != "mac" or self.toolset != "target" - ): - # Install all shared libs into a common directory (per toolset) for - # convenient access with LD_LIBRARY_PATH. - return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias) + # if self.type == "shared_library" and ( + # self.flavor != "mac" or self.toolset != "target" + # ): + # # Install all shared libs into a common directory (per toolset) for + # # convenient access with LD_LIBRARY_PATH. + # return "$(builddir)/lib.%s/%s" % (self.toolset, self.alias) return "$(builddir)/" + self.alias diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py index 5bfceb05c..e05a8a78a 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py @@ -84,7 +84,6 @@ generator_additional_non_configuration_keys = [ "msvs_enable_winrt", "msvs_requires_importlibrary", "msvs_enable_winphone", - "msvs_enable_marmasm", "msvs_application_type_revision", "msvs_target_platform_version", "msvs_target_platform_minversion", @@ -183,7 +182,8 @@ def _FixPath(path): def _IsWindowsAbsPath(path): """ - On Cygwin systems Python needs a little help determining if a path is an absolute Windows path or not, so that + On Cygwin systems Python needs a little help determining if a path + is an absolute Windows path or not, so that it does not treat those as relative, which results in bad paths like: '..\\C:\\<some path>\\some_source_code_file.cc' """ @@ -753,7 +753,7 @@ def _EscapeEnvironmentVariableExpansion(s): Returns: The escaped string. - """ + """ # noqa: E731,E123,E501 s = s.replace("%", "%%") return s @@ -846,7 +846,7 @@ def _EscapeCppDefineForMSVS(s): s = _EscapeEnvironmentVariableExpansion(s) s = _EscapeCommandLineArgumentForMSVS(s) s = _EscapeVCProjCommandLineArgListItem(s) - # cl.exe replaces literal # characters with = in preprocesor definitions for + # cl.exe replaces literal # characters with = in preprocessor definitions for # some reason. Octal-encode to work around that. s = s.replace("#", "\\%03o" % ord("#")) return s @@ -885,7 +885,7 @@ def _EscapeCppDefineForMSBuild(s): s = _EscapeEnvironmentVariableExpansion(s) s = _EscapeCommandLineArgumentForMSBuild(s) s = _EscapeMSBuildSpecialCharacters(s) - # cl.exe replaces literal # characters with = in preprocesor definitions for + # cl.exe replaces literal # characters with = in preprocessor definitions for # some reason. Octal-encode to work around that. s = s.replace("#", "\\%03o" % ord("#")) return s @@ -1029,45 +1029,6 @@ def _GenerateProject(project, options, version, generator_flags, spec): return _GenerateMSVSProject(project, options, version, generator_flags) -# TODO: Avoid code duplication with _ValidateSourcesForOSX in make.py. -def _ValidateSourcesForMSVSProject(spec, version): - """Makes sure if duplicate basenames are not specified in the source list. - - Arguments: - spec: The target dictionary containing the properties of the target. - version: The VisualStudioVersion object. - """ - # This validation should not be applied to MSVC2010 and later. - assert not version.UsesVcxproj() - - # TODO: Check if MSVC allows this for loadable_module targets. - if spec.get("type", None) not in ("static_library", "shared_library"): - return - sources = spec.get("sources", []) - basenames = {} - for source in sources: - name, ext = os.path.splitext(source) - is_compiled_file = ext in [".c", ".cc", ".cpp", ".cxx", ".m", ".mm", ".s", ".S"] - if not is_compiled_file: - continue - basename = os.path.basename(name) # Don't include extension. - basenames.setdefault(basename, []).append(source) - - error = "" - for basename, files in basenames.items(): - if len(files) > 1: - error += " %s: %s\n" % (basename, " ".join(files)) - - if error: - print( - "static library %s has several files with the same basename:\n" - % spec["target_name"] - + error - + "MSVC08 cannot handle that." - ) - raise GypError("Duplicate basenames in sources section, see list above") - - def _GenerateMSVSProject(project, options, version, generator_flags): """Generates a .vcproj file. It may create .rules and .user files too. @@ -1094,11 +1055,6 @@ def _GenerateMSVSProject(project, options, version, generator_flags): for config_name, config in spec["configurations"].items(): _AddConfigurationToMSVSProject(p, spec, config_type, config_name, config) - # MSVC08 and prior version cannot handle duplicate basenames in the same - # target. - # TODO: Take excluded sources into consideration if possible. - _ValidateSourcesForMSVSProject(spec, version) - # Prepare list of sources and excluded sources. gyp_file = os.path.split(project.build_file)[1] sources, excluded_sources = _PrepareListOfSources(spec, generator_flags, gyp_file) @@ -1415,7 +1371,7 @@ def _GetOutputTargetExt(spec): def _GetDefines(config): - """Returns the list of preprocessor definitions for this configuation. + """Returns the list of preprocessor definitions for this configuration. Arguments: config: The dictionary that defines the special processing to be done @@ -2277,7 +2233,7 @@ def _AppendFiltersForMSBuild( sources: The hierarchy of filters and sources to process. extension_to_rule_name: A dictionary mapping file extensions to rules. filter_group: The list to which filter entries will be appended. - source_group: The list to which source entries will be appeneded. + source_group: The list to which source entries will be appended. """ for source in sources: if isinstance(source, MSVSProject.Filter): @@ -2374,8 +2330,8 @@ def _GenerateRulesForMSBuild( ): # MSBuild rules are implemented using three files: an XML file, a .targets # file and a .props file. - # See http://blogs.msdn.com/b/vcblog/archive/2010/04/21/quick-help-on-vs2010-custom-build-rule.aspx - # for more details. + # For more details see: + # https://devblogs.microsoft.com/cppblog/quick-help-on-vs2010-custom-build-rule/ rules = spec.get("rules", []) rules_native = [r for r in rules if not int(r.get("msvs_external_rule", 0))] rules_external = [r for r in rules if int(r.get("msvs_external_rule", 0))] @@ -3623,8 +3579,9 @@ def _AddSources2( if precompiled_source != "": precompiled_source = _FixPath(precompiled_source) if not extensions_excluded_from_precompile: - # If the precompiled header is generated by a C source, we must - # not try to use it for C++ sources, and vice versa. + # If the precompiled header is generated by a C source, + # we must not try to use it for C++ sources, + # and vice versa. basename, extension = os.path.splitext(precompiled_source) if extension == ".c": extensions_excluded_from_precompile = [ @@ -3657,6 +3614,17 @@ def _AddSources2( extension_to_rule_name, _GetUniquePlatforms(spec), ) + if group == "compile": + # Always add an <ObjectFileName> value to support duplicate + # source file basenames. + file_name = os.path.splitext(source)[0] + ".obj" + if os.path.isabs(file_name): + file_name = os.path.splitdrive(file_name)[1] + elif file_name.startswith("..\\"): + file_name = re.sub(r"^(\.\.\\)+", "", file_name) + elif file_name.startswith("$("): + file_name = re.sub(r"^\$\([^)]+\)\\", "", file_name) + detail.append(["ObjectFileName", "$(IntDir)\\" + file_name]) grouped_sources[group].append([element, {"Include": source}] + detail) @@ -3704,6 +3672,7 @@ def _GetMSBuildProjectReferences(project): def _GenerateMSBuildProject(project, options, version, generator_flags, spec): spec = project.spec configurations = spec["configurations"] + toolset = spec["toolset"] project_dir, project_file_name = os.path.split(project.path) gyp.common.EnsureDirExists(project.path) # Prepare list of sources and excluded sources. @@ -3717,6 +3686,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags, spec): rule_dependencies = set() extension_to_rule_name = {} list_excluded = generator_flags.get("msvs_list_excluded_files", True) + platforms = _GetUniquePlatforms(spec) # Don't generate rules if we are using an external builder like ninja. if not spec.get("msvs_external_builder"): @@ -3759,7 +3729,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags, spec): sources, rule_dependencies, extension_to_rule_name, - _GetUniquePlatforms(spec), + platforms, ) missing_sources = _VerifySourcesExist(sources, project_dir) @@ -3812,7 +3782,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags, spec): content += _GetMSBuildLocalProperties(project.msbuild_toolset) content += import_cpp_props_section content += import_masm_props_section - if spec.get("msvs_enable_marmasm"): + if "arm64" in platforms and toolset == "target": content += import_marmasm_props_section content += _GetMSBuildExtensions(props_files_of_rules) content += _GetMSBuildPropertySheets(configurations, spec) @@ -3834,7 +3804,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags, spec): content += _GetMSBuildProjectReferences(project) content += import_cpp_targets_section content += import_masm_targets_section - if spec.get("msvs_enable_marmasm"): + if "arm64" in platforms and toolset == "target": content += import_marmasm_targets_section content += _GetMSBuildExtensionTargets(targets_files_of_rules) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py index 384b252e7..e064bad7e 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py @@ -90,7 +90,7 @@ def Define(d, flavor): """Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.""" if flavor == "win": - # cl.exe replaces literal # characters with = in preprocesor definitions for + # cl.exe replaces literal # characters with = in preprocessor definitions for # some reason. Octal-encode to work around that. d = d.replace("#", "\\%03o" % ord("#")) return QuoteShellArgument(ninja_syntax.escape("-D" + d), flavor) @@ -781,9 +781,10 @@ class NinjaWriter(object): rule.get("process_outputs_as_mac_bundle_resources", False) ): extra_mac_bundle_resources += outputs - # Note: This is n_resources * n_outputs_in_rule. Put to-be-removed - # items in a set and remove them all in a single pass if this becomes - # a performance issue. + # Note: This is n_resources * n_outputs_in_rule. + # Put to-be-removed items in a set and + # remove them all in a single pass + # if this becomes a performance issue. if was_mac_bundle_resource: mac_bundle_resources.remove(source) @@ -816,7 +817,7 @@ class NinjaWriter(object): outputs = [self.GypPathToNinja(o, env) for o in outputs] if self.flavor == "win": - # WriteNewNinjaRule uses unique_name for creating an rsp file on win. + # WriteNewNinjaRule uses unique_name to create a rsp file on win. extra_bindings.append( ("unique_name", hashlib.md5(outputs[0]).hexdigest()) ) @@ -853,11 +854,12 @@ class NinjaWriter(object): outputs += self.ninja.build(dst, "copy", src, order_only=prebuild) if self.is_mac_bundle: # gyp has mac_bundle_resources to copy things into a bundle's - # Resources folder, but there's no built-in way to copy files to other - # places in the bundle. Hence, some targets use copies for this. Check - # if this file is copied into the current bundle, and if so add it to - # the bundle depends so that dependent targets get rebuilt if the copy - # input changes. + # Resources folder, but there's no built-in way to copy files + # to other places in the bundle. + # Hence, some targets use copies for this. + # Check if this file is copied into the current bundle, + # and if so add it to the bundle depends so + # that dependent targets get rebuilt if the copy input changes. if dst.startswith( self.xcode_settings.GetBundleContentsFolderPath() ): @@ -1513,8 +1515,8 @@ class NinjaWriter(object): if self.flavor != "win": link_file_list = output if self.is_mac_bundle: - # 'Dependency Framework.framework/Versions/A/Dependency Framework' -> - # 'Dependency Framework.framework.rsp' + # 'Dependency Framework.framework/Versions/A/Dependency Framework' + # -> 'Dependency Framework.framework.rsp' link_file_list = self.xcode_settings.GetWrapperName() if arch: link_file_list += "." + arch @@ -1628,7 +1630,8 @@ class NinjaWriter(object): variables=variables, ) inputs.append(output) - # TODO: It's not clear if libtool_flags should be passed to the alink + # TODO: It's not clear if + # libtool_flags should be passed to the alink # call that combines single-arch .a files into a fat .a file. self.AppendPostbuildVariable( variables, spec, self.target.binary, self.target.binary @@ -2535,9 +2538,10 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params, config_name "solink", description="SOLINK $lib", restat=True, - command=mtime_preserving_solink_base % {"suffix": "@$link_file_list"}, + command=mtime_preserving_solink_base % {"suffix": "@$link_file_list"}, # noqa: E501 rspfile="$link_file_list", - rspfile_content="-Wl,--whole-archive $in $solibs -Wl,--no-whole-archive $libs", + rspfile_content=("-Wl,--whole-archive $in $solibs -Wl," + "--no-whole-archive $libs"), pool="link_pool", ) master_ninja.rule( diff --git a/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py b/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py index 535c5400c..9e7e99e9e 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py @@ -594,7 +594,7 @@ _xcode_define_re = re.compile(r"([\\\"\' ])") def EscapeXcodeDefine(s): """We must escape the defines that we give to XCode so that it knows not to split on spaces and to respect backslash and quote literals. However, we - must not quote the define, or Xcode will incorrectly intepret variables + must not quote the define, or Xcode will incorrectly interpret variables especially $(inherited).""" return re.sub(_xcode_define_re, r"\\\1", s) @@ -735,7 +735,8 @@ def GenerateOutput(target_list, target_dicts, data, params): "loadable_module+xcuitest": "com.apple.product-type.bundle.ui-testing", "shared_library+bundle": "com.apple.product-type.framework", "executable+extension+bundle": "com.apple.product-type.app-extension", - "executable+watch+extension+bundle": "com.apple.product-type.watchkit-extension", + "executable+watch+extension+bundle": + "com.apple.product-type.watchkit-extension", "executable+watch+bundle": "com.apple.product-type.application.watchapp", "mac_kernel_extension+bundle": "com.apple.product-type.kernel-extension", } @@ -1026,7 +1027,7 @@ def GenerateOutput(target_list, target_dicts, data, params): for output in rule.get("outputs", []): # Fortunately, Xcode and make both use $(VAR) format for their # variables, so the expansion is the only transformation necessary. - # Any remaning $(VAR)-type variables in the string can be given + # Any remaining $(VAR)-type variables in the string can be given # directly to make, which will pick up the correct settings from # what Xcode puts into the environment. concrete_output = ExpandXcodeVariables(output, rule_input_dict) @@ -1151,8 +1152,8 @@ def GenerateOutput(target_list, target_dicts, data, params): '\t@mkdir -p "%s"\n' % '" "'.join(concrete_output_dirs) ) - # The rule message and action have already had the necessary variable - # substitutions performed. + # The rule message and action have already had + # the necessary variable substitutions performed. if message: # Mark it with note: so Xcode picks it up in build output. makefile.write("\t@echo note: %s\n" % message) @@ -1204,8 +1205,8 @@ exit 1 support_xct.AppendProperty("buildPhases", ssbp) else: # TODO(mark): this assumes too much knowledge of the internals of - # xcodeproj_file; some of these smarts should move into xcodeproj_file - # itself. + # xcodeproj_file; some of these smarts should move + # into xcodeproj_file itself. xct._properties["buildPhases"].insert(prebuild_index, ssbp) prebuild_index = prebuild_index + 1 diff --git a/node_modules/node-gyp/gyp/pylib/gyp/input.py b/node_modules/node-gyp/gyp/pylib/gyp/input.py index 00c4ee1f9..5504390c0 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/input.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/input.py @@ -66,7 +66,7 @@ def IsPathSection(section): if section in path_sections: return True - # Sections mathing the regexp '_(dir|file|path)s?$' are also + # Sections matching the regexp '_(dir|file|path)s?$' are also # considered PathSections. Using manual string matching since that # is much faster than the regexp and this can be called hundreds of # thousands of times so micro performance matters. @@ -232,8 +232,8 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check # to make sure platform specific newlines ('\r\n' or '\r') are converted to '\n' # which otherwise will fail eval() if sys.platform == "zos": - # On z/OS, universal-newlines mode treats the file as an ascii file. But since - # node-gyp produces ebcdic files, do not use that mode. + # On z/OS, universal-newlines mode treats the file as an ascii file. + # But since node-gyp produces ebcdic files, do not use that mode. build_file_contents = open(build_file_path, "r").read() else: build_file_contents = open(build_file_path, "rU").read() @@ -1731,10 +1731,10 @@ class DependencyGraphNode(object): node_dependent.dependencies, key=ExtractNodeRef ): if node_dependent_dependency.ref not in flat_list: - # The dependent one or more dependencies not in flat_list. There - # will be more chances to add it to flat_list when examining - # it again as a dependent of those other dependencies, provided - # that there are no cycles. + # The dependent one or more dependencies not in flat_list. + # There will be more chances to add it to flat_list + # when examining it again as a dependent of those other + # dependencies, provided that there are no cycles. is_in_degree_zero = False break @@ -2427,7 +2427,7 @@ def MergeDicts(to, fro, to_file, fro_file): def MergeConfigWithInheritance( new_configuration_dict, build_file, target_dict, configuration, visited ): - # Skip if previously visted. + # Skip if previously visited. if configuration in visited: return @@ -2641,10 +2641,10 @@ def ProcessListFiltersInDict(name, the_dict): pattern_re = re.compile(pattern) if action == "exclude": - # This item matches an exclude regex, so set its value to 0 (exclude). + # This item matches an exclude regex, set its value to 0 (exclude). action_value = 0 elif action == "include": - # This item matches an include regex, so set its value to 1 (include). + # This item matches an include regex, set its value to 1 (include). action_value = 1 else: # This is an action that doesn't make any sense. @@ -2659,8 +2659,8 @@ def ProcessListFiltersInDict(name, the_dict): for index, list_item in enumerate(the_list): if list_actions[index] == action_value: - # Even if the regex matches, nothing will change so continue (regex - # searches are expensive). + # Even if the regex matches, nothing will change so continue + # (regex searches are expensive). continue if pattern_re.search(list_item): # Regular expression match. @@ -2750,36 +2750,6 @@ def ValidateTargetType(target, target_dict): ) -def ValidateSourcesInTarget(target, target_dict, build_file, duplicate_basename_check): - if not duplicate_basename_check: - return - if target_dict.get("type", None) != "static_library": - return - sources = target_dict.get("sources", []) - basenames = {} - for source in sources: - name, ext = os.path.splitext(source) - is_compiled_file = ext in [".c", ".cc", ".cpp", ".cxx", ".m", ".mm", ".s", ".S"] - if not is_compiled_file: - continue - basename = os.path.basename(name) # Don't include extension. - basenames.setdefault(basename, []).append(source) - - error = "" - for basename, files in basenames.items(): - if len(files) > 1: - error += " %s: %s\n" % (basename, " ".join(files)) - - if error: - print( - "static library %s has several files with the same basename:\n" % target - + error - + "libtool on Mac cannot handle that. Use " - "--no-duplicate-basename-check to disable this validation." - ) - raise GypError("Duplicate basenames in sources section, see list above") - - def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): """Ensures that the rules sections in target_dict are valid and consistent, and determines which sources they apply to. @@ -3021,7 +2991,6 @@ def Load( generator_input_info, check, circular_check, - duplicate_basename_check, parallel, root_targets, ): @@ -3167,9 +3136,6 @@ def Load( target_dict = targets[target] build_file = gyp.common.BuildFile(target) ValidateTargetType(target, target_dict) - ValidateSourcesInTarget( - target, target_dict, build_file, duplicate_basename_check - ) ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) ValidateRunAsInTarget(target, target_dict, build_file) ValidateActionsInTarget(target, target_dict, build_file) diff --git a/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py b/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py index c665c9bf9..1afc1d687 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py @@ -814,8 +814,8 @@ class MsvsSettings(object): manifest_files = [] generated_manifest_outer = ( "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" - "<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>%s" - "</assembly>" + "<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>" + "%s</assembly>" ) if enable_uac == "true": execution_level = self._Setting( diff --git a/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py index 42a4ce47e..8af2b39f9 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py @@ -113,7 +113,7 @@ def GetXcodeArchsDefault(): of $(ARCHS_STANDARD_INCLUDING_64_BIT) from Xcode 5.0. From Xcode 5.1, they are also part of $(ARCHS_STANDARD). - All thoses rules are coded in the construction of the |XcodeArchsDefault| + All these rules are coded in the construction of the |XcodeArchsDefault| object to use depending on the version of Xcode detected. The object is for performance reason.""" global XCODE_ARCHS_DEFAULT_CACHE @@ -1528,7 +1528,9 @@ def CLTVersion(): # volume: / # location: / # install-time: 1382544035 - # groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group + # groups: com.apple.FindSystemFiles.pkg-group + # com.apple.DevToolsBoth.pkg-group + # com.apple.DevToolsNonRelocatableShared.pkg-group STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo" FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI" MAVERICKS_PKG_ID = "com.apple.pkg.CLTools_Executables" @@ -1732,7 +1734,8 @@ def _GetXcodeEnv( "BUILT_PRODUCTS_DIR": built_products_dir, "CONFIGURATION": configuration, "PRODUCT_NAME": xcode_settings.GetProductName(), - # See /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\ Product\ Types.xcspec for FULL_PRODUCT_NAME + # For FULL_PRODUCT_NAME see: + # /Developer/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications/MacOSX\ Product\ Types.xcspec # noqa: E501 "SRCROOT": srcroot, "SOURCE_ROOT": "${SRCROOT}", # This is not true for static libraries, but currently the env is only diff --git a/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py b/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py index cde4f055f..d90dd99dc 100644 --- a/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +++ b/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py @@ -515,7 +515,7 @@ class XCObject(object): return None def _EncodeComment(self, comment): - """Encodes a comment to be placed in the project file output, mimicing + """Encodes a comment to be placed in the project file output, mimicking Xcode behavior. """ @@ -543,7 +543,7 @@ class XCObject(object): return self._encode_transforms[ord(char)] def _EncodeString(self, value): - """Encodes a string to be placed in the project file output, mimicing + """Encodes a string to be placed in the project file output, mimicking Xcode behavior. """ @@ -586,7 +586,7 @@ class XCObject(object): def _XCPrintableValue(self, tabs, value, flatten_list=False): """Returns a representation of value that may be printed in a project file, - mimicing Xcode's behavior. + mimicking Xcode's behavior. _XCPrintableValue can handle str and int values, XCObjects (which are made printable by returning their id property), and list and dict objects @@ -831,8 +831,8 @@ class XCObject(object): self._properties[property] = value elif isinstance(value, list): if is_strong: - # If is_strong is True, each element is an XCObject, so it's safe - # to call Copy. + # If is_strong is True, each element is an XCObject, + # so it's safe to call Copy. self._properties[property] = [] for item in value: self._properties[property].append(item.Copy()) @@ -2132,9 +2132,10 @@ class PBXCopyFilesBuildPhase(XCBuildPhase): # to the target. Xcode uses the dstSubfolderSpec value set here # to determine the full path. # - # An alternative of xcode_emulation.py setting the values to absolute - # paths when exporting these variables has been ruled out because - # then the values would be different depending on the build tool. + # An alternative of xcode_emulation.py setting the values to + # absolute paths when exporting these variables has been + # ruled out because then the values would be different + # depending on the build tool. # # Another alternative is to invent new names for the variables used # to match to the subfolder indices in the second table. .gyp files @@ -2146,7 +2147,8 @@ class PBXCopyFilesBuildPhase(XCBuildPhase): # Requiring prepending BUILT_PRODUCTS_DIR has been chosen because # this same way could be used to specify destinations in .gyp files # that pre-date this addition to GYP. However they would only work - # with the Xcode generator. The previous version of xcode_emulation.py + # with the Xcode generator. + # The previous version of xcode_emulation.py # does not export these variables. Such files will get the benefit # of the Xcode UI showing the proper destination name simply by # regenerating the projects with this version of GYP. diff --git a/node_modules/node-gyp/gyp/setup.py b/node_modules/node-gyp/gyp/setup.py index 0f75a99b1..befcdb22b 100755 --- a/node_modules/node-gyp/gyp/setup.py +++ b/node_modules/node-gyp/gyp/setup.py @@ -15,7 +15,7 @@ with open(path.join(here, "README.md")) as in_file: setup( name="gyp-next", - version="0.4.0", + version="0.6.1", description="A fork of the GYP build system for use in the Node.js projects", long_description=long_description, long_description_content_type="text/markdown", diff --git a/node_modules/node-gyp/gyp/tools/pretty_vcproj.py b/node_modules/node-gyp/gyp/tools/pretty_vcproj.py index 38fbf3fec..b171fae6c 100755 --- a/node_modules/node-gyp/gyp/tools/pretty_vcproj.py +++ b/node_modules/node-gyp/gyp/tools/pretty_vcproj.py @@ -161,7 +161,7 @@ def CleanupVcproj(node): AbsoluteNode(sub_node) CleanupVcproj(sub_node) - # Normalize the node, and remove all extranous whitespaces. + # Normalize the node, and remove all extraneous whitespaces. for sub_node in node.childNodes: if sub_node.nodeType == Node.TEXT_NODE: sub_node.data = sub_node.data.replace("\r", "") diff --git a/node_modules/node-gyp/lib/find-visualstudio.js b/node_modules/node-gyp/lib/find-visualstudio.js index c5d26f9a2..9c6dad90f 100644 --- a/node_modules/node-gyp/lib/find-visualstudio.js +++ b/node_modules/node-gyp/lib/find-visualstudio.js @@ -151,7 +151,7 @@ VisualStudioFinder.prototype = { const failPowershell = () => { this.addLog( - 'could not use PowerShell to find Visual Studio 2017 or newer') + 'could not use PowerShell to find Visual Studio 2017 or newer, try re-running with \'--loglevel silly\' for more details') cb(null) } diff --git a/node_modules/node-gyp/node_modules/.bin/nopt b/node_modules/node-gyp/node_modules/.bin/nopt deleted file mode 120000 index 6b6566ea7..000000000 --- a/node_modules/node-gyp/node_modules/.bin/nopt +++ /dev/null @@ -1 +0,0 @@ -../nopt/bin/nopt.js
\ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/.bin/rimraf b/node_modules/node-gyp/node_modules/.bin/rimraf deleted file mode 120000 index 4cd49a49d..000000000 --- a/node_modules/node-gyp/node_modules/.bin/rimraf +++ /dev/null @@ -1 +0,0 @@ -../rimraf/bin.js
\ No newline at end of file diff --git a/node_modules/node-gyp/node_modules/nopt/CHANGELOG.md b/node_modules/node-gyp/node_modules/nopt/CHANGELOG.md deleted file mode 100644 index 82a09fb4b..000000000 --- a/node_modules/node-gyp/node_modules/nopt/CHANGELOG.md +++ /dev/null @@ -1,58 +0,0 @@ -### v4.0.1 (2016-12-14) - -#### WHOOPS - -* [`fb9b1ce`](https://github.com/npm/nopt/commit/fb9b1ce57b3c69b4f7819015be87719204f77ef6) - Merged so many patches at once that the code fencing - ([@adius](https://github.com/adius)) added got broken. Sorry, - ([@adius](https://github.com/adius))! - ([@othiym23](https://github.com/othiym23)) - -### v4.0.0 (2016-12-13) - -#### BREAKING CHANGES - -* [`651d447`](https://github.com/npm/nopt/commit/651d4473946096d341a480bbe56793de3fc706aa) - When parsing String-typed arguments, if the next value is `""`, don't simply - swallow it. ([@samjonester](https://github.com/samjonester)) - -#### PERFORMANCE TWEAKS - -* [`3370ce8`](https://github.com/npm/nopt/commit/3370ce87a7618ba228883861db84ddbcdff252a9) - Simplify initialization. ([@elidoran](https://github.com/elidoran)) -* [`356e58e`](https://github.com/npm/nopt/commit/356e58e3b3b431a4b1af7fd7bdee44c2c0526a09) - Store `Array.isArray(types[arg])` for reuse. - ([@elidoran](https://github.com/elidoran)) -* [`0d95e90`](https://github.com/npm/nopt/commit/0d95e90515844f266015b56d2c80b94e5d14a07e) - Interpret single-item type arrays as a single type. - ([@samjonester](https://github.com/samjonester)) -* [`07c69d3`](https://github.com/npm/nopt/commit/07c69d38b5186450941fbb505550becb78a0e925) - Simplify key-value extraction. ([@elidoran](https://github.com/elidoran)) -* [`39b6e5c`](https://github.com/npm/nopt/commit/39b6e5c65ac47f60cd43a1fbeece5cd4c834c254) - Only call `Date.parse(val)` once. ([@elidoran](https://github.com/elidoran)) -* [`934943d`](https://github.com/npm/nopt/commit/934943dffecb55123a2b15959fe2a359319a5dbd) - Use `osenv.home()` to find a user's home directory instead of assuming it's - always `$HOME`. ([@othiym23](https://github.com/othiym23)) - -#### TEST & CI IMPROVEMENTS - -* [`326ffff`](https://github.com/npm/nopt/commit/326ffff7f78a00bcd316adecf69075f8a8093619) - Fix `/tmp` test to work on Windows. - ([@elidoran](https://github.com/elidoran)) -* [`c89d31a`](https://github.com/npm/nopt/commit/c89d31a49d14f2238bc6672db08da697bbc57f1b) - Only run Windows tests on Windows, only run Unix tests on a Unix. - ([@elidoran](https://github.com/elidoran)) -* [`affd3d1`](https://github.com/npm/nopt/commit/affd3d1d0addffa93006397b2013b18447339366) - Refresh Travis to run the tests against the currently-supported batch of npm - versions. ([@helio](https://github.com/helio)-frota) -* [`55f9449`](https://github.com/npm/nopt/commit/55f94497d163ed4d16dd55fd6c4fb95cc440e66d) - `tap@8.0.1` ([@othiym23](https://github.com/othiym23)) - -#### DOC TWEAKS - -* [`5271229`](https://github.com/npm/nopt/commit/5271229ee7c810217dd51616c086f5d9ab224581) - Use JavaScript code block for syntax highlighting. - ([@adius](https://github.com/adius)) -* [`c0d156f`](https://github.com/npm/nopt/commit/c0d156f229f9994c5dfcec4a8886eceff7a07682) - The code sample in the README had `many2: [ oneThing ]`, and now it has - `many2: [ two, things ]`. ([@silkentrance](https://github.com/silkentrance)) diff --git a/node_modules/node-gyp/node_modules/nopt/LICENSE b/node_modules/node-gyp/node_modules/nopt/LICENSE deleted file mode 100644 index 19129e315..000000000 --- a/node_modules/node-gyp/node_modules/nopt/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/nopt/README.md b/node_modules/node-gyp/node_modules/nopt/README.md deleted file mode 100644 index a99531c04..000000000 --- a/node_modules/node-gyp/node_modules/nopt/README.md +++ /dev/null @@ -1,213 +0,0 @@ -If you want to write an option parser, and have it be good, there are -two ways to do it. The Right Way, and the Wrong Way. - -The Wrong Way is to sit down and write an option parser. We've all done -that. - -The Right Way is to write some complex configurable program with so many -options that you hit the limit of your frustration just trying to -manage them all, and defer it with duct-tape solutions until you see -exactly to the core of the problem, and finally snap and write an -awesome option parser. - -If you want to write an option parser, don't write an option parser. -Write a package manager, or a source control system, or a service -restarter, or an operating system. You probably won't end up with a -good one of those, but if you don't give up, and you are relentless and -diligent enough in your procrastination, you may just end up with a very -nice option parser. - -## USAGE - -```javascript -// my-program.js -var nopt = require("nopt") - , Stream = require("stream").Stream - , path = require("path") - , knownOpts = { "foo" : [String, null] - , "bar" : [Stream, Number] - , "baz" : path - , "bloo" : [ "big", "medium", "small" ] - , "flag" : Boolean - , "pick" : Boolean - , "many1" : [String, Array] - , "many2" : [path, Array] - } - , shortHands = { "foofoo" : ["--foo", "Mr. Foo"] - , "b7" : ["--bar", "7"] - , "m" : ["--bloo", "medium"] - , "p" : ["--pick"] - , "f" : ["--flag"] - } - // everything is optional. - // knownOpts and shorthands default to {} - // arg list defaults to process.argv - // slice defaults to 2 - , parsed = nopt(knownOpts, shortHands, process.argv, 2) -console.log(parsed) -``` - -This would give you support for any of the following: - -```console -$ node my-program.js --foo "blerp" --no-flag -{ "foo" : "blerp", "flag" : false } - -$ node my-program.js ---bar 7 --foo "Mr. Hand" --flag -{ bar: 7, foo: "Mr. Hand", flag: true } - -$ node my-program.js --foo "blerp" -f -----p -{ foo: "blerp", flag: true, pick: true } - -$ node my-program.js -fp --foofoo -{ foo: "Mr. Foo", flag: true, pick: true } - -$ node my-program.js --foofoo -- -fp # -- stops the flag parsing. -{ foo: "Mr. Foo", argv: { remain: ["-fp"] } } - -$ node my-program.js --blatzk -fp # unknown opts are ok. -{ blatzk: true, flag: true, pick: true } - -$ node my-program.js --blatzk=1000 -fp # but you need to use = if they have a value -{ blatzk: 1000, flag: true, pick: true } - -$ node my-program.js --no-blatzk -fp # unless they start with "no-" -{ blatzk: false, flag: true, pick: true } - -$ node my-program.js --baz b/a/z # known paths are resolved. -{ baz: "/Users/isaacs/b/a/z" } - -# if Array is one of the types, then it can take many -# values, and will always be an array. The other types provided -# specify what types are allowed in the list. - -$ node my-program.js --many1 5 --many1 null --many1 foo -{ many1: ["5", "null", "foo"] } - -$ node my-program.js --many2 foo --many2 bar -{ many2: ["/path/to/foo", "path/to/bar"] } -``` - -Read the tests at the bottom of `lib/nopt.js` for more examples of -what this puppy can do. - -## Types - -The following types are supported, and defined on `nopt.typeDefs` - -* String: A normal string. No parsing is done. -* path: A file system path. Gets resolved against cwd if not absolute. -* url: A url. If it doesn't parse, it isn't accepted. -* Number: Must be numeric. -* Date: Must parse as a date. If it does, and `Date` is one of the options, - then it will return a Date object, not a string. -* Boolean: Must be either `true` or `false`. If an option is a boolean, - then it does not need a value, and its presence will imply `true` as - the value. To negate boolean flags, do `--no-whatever` or `--whatever - false` -* NaN: Means that the option is strictly not allowed. Any value will - fail. -* Stream: An object matching the "Stream" class in node. Valuable - for use when validating programmatically. (npm uses this to let you - supply any WriteStream on the `outfd` and `logfd` config options.) -* Array: If `Array` is specified as one of the types, then the value - will be parsed as a list of options. This means that multiple values - can be specified, and that the value will always be an array. - -If a type is an array of values not on this list, then those are -considered valid values. For instance, in the example above, the -`--bloo` option can only be one of `"big"`, `"medium"`, or `"small"`, -and any other value will be rejected. - -When parsing unknown fields, `"true"`, `"false"`, and `"null"` will be -interpreted as their JavaScript equivalents. - -You can also mix types and values, or multiple types, in a list. For -instance `{ blah: [Number, null] }` would allow a value to be set to -either a Number or null. When types are ordered, this implies a -preference, and the first type that can be used to properly interpret -the value will be used. - -To define a new type, add it to `nopt.typeDefs`. Each item in that -hash is an object with a `type` member and a `validate` method. The -`type` member is an object that matches what goes in the type list. The -`validate` method is a function that gets called with `validate(data, -key, val)`. Validate methods should assign `data[key]` to the valid -value of `val` if it can be handled properly, or return boolean -`false` if it cannot. - -You can also call `nopt.clean(data, types, typeDefs)` to clean up a -config object and remove its invalid properties. - -## Error Handling - -By default, nopt outputs a warning to standard error when invalid values for -known options are found. You can change this behavior by assigning a method -to `nopt.invalidHandler`. This method will be called with -the offending `nopt.invalidHandler(key, val, types)`. - -If no `nopt.invalidHandler` is assigned, then it will console.error -its whining. If it is assigned to boolean `false` then the warning is -suppressed. - -## Abbreviations - -Yes, they are supported. If you define options like this: - -```javascript -{ "foolhardyelephants" : Boolean -, "pileofmonkeys" : Boolean } -``` - -Then this will work: - -```bash -node program.js --foolhar --pil -node program.js --no-f --pileofmon -# etc. -``` - -## Shorthands - -Shorthands are a hash of shorter option names to a snippet of args that -they expand to. - -If multiple one-character shorthands are all combined, and the -combination does not unambiguously match any other option or shorthand, -then they will be broken up into their constituent parts. For example: - -```json -{ "s" : ["--loglevel", "silent"] -, "g" : "--global" -, "f" : "--force" -, "p" : "--parseable" -, "l" : "--long" -} -``` - -```bash -npm ls -sgflp -# just like doing this: -npm ls --loglevel silent --global --force --long --parseable -``` - -## The Rest of the args - -The config object returned by nopt is given a special member called -`argv`, which is an object with the following fields: - -* `remain`: The remaining args after all the parsing has occurred. -* `original`: The args as they originally appeared. -* `cooked`: The args after flags and shorthands are expanded. - -## Slicing - -Node programs are called with more or less the exact argv as it appears -in C land, after the v8 and node-specific options have been plucked off. -As such, `argv[0]` is always `node` and `argv[1]` is always the -JavaScript program being run. - -That's usually not very useful to you. So they're sliced off by -default. If you want them, then you can pass in `0` as the last -argument, or any other number that you'd like to slice off the start of -the list. diff --git a/node_modules/node-gyp/node_modules/nopt/bin/nopt.js b/node_modules/node-gyp/node_modules/nopt/bin/nopt.js deleted file mode 100755 index 3232d4c57..000000000 --- a/node_modules/node-gyp/node_modules/nopt/bin/nopt.js +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env node -var nopt = require("../lib/nopt") - , path = require("path") - , types = { num: Number - , bool: Boolean - , help: Boolean - , list: Array - , "num-list": [Number, Array] - , "str-list": [String, Array] - , "bool-list": [Boolean, Array] - , str: String - , clear: Boolean - , config: Boolean - , length: Number - , file: path - } - , shorthands = { s: [ "--str", "astring" ] - , b: [ "--bool" ] - , nb: [ "--no-bool" ] - , tft: [ "--bool-list", "--no-bool-list", "--bool-list", "true" ] - , "?": ["--help"] - , h: ["--help"] - , H: ["--help"] - , n: [ "--num", "125" ] - , c: ["--config"] - , l: ["--length"] - , f: ["--file"] - } - , parsed = nopt( types - , shorthands - , process.argv - , 2 ) - -console.log("parsed", parsed) - -if (parsed.help) { - console.log("") - console.log("nopt cli tester") - console.log("") - console.log("types") - console.log(Object.keys(types).map(function M (t) { - var type = types[t] - if (Array.isArray(type)) { - return [t, type.map(function (type) { return type.name })] - } - return [t, type && type.name] - }).reduce(function (s, i) { - s[i[0]] = i[1] - return s - }, {})) - console.log("") - console.log("shorthands") - console.log(shorthands) -} diff --git a/node_modules/node-gyp/node_modules/nopt/lib/nopt.js b/node_modules/node-gyp/node_modules/nopt/lib/nopt.js deleted file mode 100644 index 0ec5753d0..000000000 --- a/node_modules/node-gyp/node_modules/nopt/lib/nopt.js +++ /dev/null @@ -1,441 +0,0 @@ -// info about each config option. - -var debug = process.env.DEBUG_NOPT || process.env.NOPT_DEBUG - ? function () { console.error.apply(console, arguments) } - : function () {} - -var url = require("url") - , path = require("path") - , Stream = require("stream").Stream - , abbrev = require("abbrev") - , osenv = require("osenv") - -module.exports = exports = nopt -exports.clean = clean - -exports.typeDefs = - { String : { type: String, validate: validateString } - , Boolean : { type: Boolean, validate: validateBoolean } - , url : { type: url, validate: validateUrl } - , Number : { type: Number, validate: validateNumber } - , path : { type: path, validate: validatePath } - , Stream : { type: Stream, validate: validateStream } - , Date : { type: Date, validate: validateDate } - } - -function nopt (types, shorthands, args, slice) { - args = args || process.argv - types = types || {} - shorthands = shorthands || {} - if (typeof slice !== "number") slice = 2 - - debug(types, shorthands, args, slice) - - args = args.slice(slice) - var data = {} - , key - , argv = { - remain: [], - cooked: args, - original: args.slice(0) - } - - parse(args, data, argv.remain, types, shorthands) - // now data is full - clean(data, types, exports.typeDefs) - data.argv = argv - Object.defineProperty(data.argv, 'toString', { value: function () { - return this.original.map(JSON.stringify).join(" ") - }, enumerable: false }) - return data -} - -function clean (data, types, typeDefs) { - typeDefs = typeDefs || exports.typeDefs - var remove = {} - , typeDefault = [false, true, null, String, Array] - - Object.keys(data).forEach(function (k) { - if (k === "argv") return - var val = data[k] - , isArray = Array.isArray(val) - , type = types[k] - if (!isArray) val = [val] - if (!type) type = typeDefault - if (type === Array) type = typeDefault.concat(Array) - if (!Array.isArray(type)) type = [type] - - debug("val=%j", val) - debug("types=", type) - val = val.map(function (val) { - // if it's an unknown value, then parse false/true/null/numbers/dates - if (typeof val === "string") { - debug("string %j", val) - val = val.trim() - if ((val === "null" && ~type.indexOf(null)) - || (val === "true" && - (~type.indexOf(true) || ~type.indexOf(Boolean))) - || (val === "false" && - (~type.indexOf(false) || ~type.indexOf(Boolean)))) { - val = JSON.parse(val) - debug("jsonable %j", val) - } else if (~type.indexOf(Number) && !isNaN(val)) { - debug("convert to number", val) - val = +val - } else if (~type.indexOf(Date) && !isNaN(Date.parse(val))) { - debug("convert to date", val) - val = new Date(val) - } - } - - if (!types.hasOwnProperty(k)) { - return val - } - - // allow `--no-blah` to set 'blah' to null if null is allowed - if (val === false && ~type.indexOf(null) && - !(~type.indexOf(false) || ~type.indexOf(Boolean))) { - val = null - } - - var d = {} - d[k] = val - debug("prevalidated val", d, val, types[k]) - if (!validate(d, k, val, types[k], typeDefs)) { - if (exports.invalidHandler) { - exports.invalidHandler(k, val, types[k], data) - } else if (exports.invalidHandler !== false) { - debug("invalid: "+k+"="+val, types[k]) - } - return remove - } - debug("validated val", d, val, types[k]) - return d[k] - }).filter(function (val) { return val !== remove }) - - // if we allow Array specifically, then an empty array is how we - // express 'no value here', not null. Allow it. - if (!val.length && type.indexOf(Array) === -1) { - debug('VAL HAS NO LENGTH, DELETE IT', val, k, type.indexOf(Array)) - delete data[k] - } - else if (isArray) { - debug(isArray, data[k], val) - data[k] = val - } else data[k] = val[0] - - debug("k=%s val=%j", k, val, data[k]) - }) -} - -function validateString (data, k, val) { - data[k] = String(val) -} - -function validatePath (data, k, val) { - if (val === true) return false - if (val === null) return true - - val = String(val) - - var isWin = process.platform === 'win32' - , homePattern = isWin ? /^~(\/|\\)/ : /^~\// - , home = osenv.home() - - if (home && val.match(homePattern)) { - data[k] = path.resolve(home, val.substr(2)) - } else { - data[k] = path.resolve(val) - } - return true -} - -function validateNumber (data, k, val) { - debug("validate Number %j %j %j", k, val, isNaN(val)) - if (isNaN(val)) return false - data[k] = +val -} - -function validateDate (data, k, val) { - var s = Date.parse(val) - debug("validate Date %j %j %j", k, val, s) - if (isNaN(s)) return false - data[k] = new Date(val) -} - -function validateBoolean (data, k, val) { - if (val instanceof Boolean) val = val.valueOf() - else if (typeof val === "string") { - if (!isNaN(val)) val = !!(+val) - else if (val === "null" || val === "false") val = false - else val = true - } else val = !!val - data[k] = val -} - -function validateUrl (data, k, val) { - val = url.parse(String(val)) - if (!val.host) return false - data[k] = val.href -} - -function validateStream (data, k, val) { - if (!(val instanceof Stream)) return false - data[k] = val -} - -function validate (data, k, val, type, typeDefs) { - // arrays are lists of types. - if (Array.isArray(type)) { - for (var i = 0, l = type.length; i < l; i ++) { - if (type[i] === Array) continue - if (validate(data, k, val, type[i], typeDefs)) return true - } - delete data[k] - return false - } - - // an array of anything? - if (type === Array) return true - - // NaN is poisonous. Means that something is not allowed. - if (type !== type) { - debug("Poison NaN", k, val, type) - delete data[k] - return false - } - - // explicit list of values - if (val === type) { - debug("Explicitly allowed %j", val) - // if (isArray) (data[k] = data[k] || []).push(val) - // else data[k] = val - data[k] = val - return true - } - - // now go through the list of typeDefs, validate against each one. - var ok = false - , types = Object.keys(typeDefs) - for (var i = 0, l = types.length; i < l; i ++) { - debug("test type %j %j %j", k, val, types[i]) - var t = typeDefs[types[i]] - if (t && - ((type && type.name && t.type && t.type.name) ? (type.name === t.type.name) : (type === t.type))) { - var d = {} - ok = false !== t.validate(d, k, val) - val = d[k] - if (ok) { - // if (isArray) (data[k] = data[k] || []).push(val) - // else data[k] = val - data[k] = val - break - } - } - } - debug("OK? %j (%j %j %j)", ok, k, val, types[i]) - - if (!ok) delete data[k] - return ok -} - -function parse (args, data, remain, types, shorthands) { - debug("parse", args, data, remain) - - var key = null - , abbrevs = abbrev(Object.keys(types)) - , shortAbbr = abbrev(Object.keys(shorthands)) - - for (var i = 0; i < args.length; i ++) { - var arg = args[i] - debug("arg", arg) - - if (arg.match(/^-{2,}$/)) { - // done with keys. - // the rest are args. - remain.push.apply(remain, args.slice(i + 1)) - args[i] = "--" - break - } - var hadEq = false - if (arg.charAt(0) === "-" && arg.length > 1) { - var at = arg.indexOf('=') - if (at > -1) { - hadEq = true - var v = arg.substr(at + 1) - arg = arg.substr(0, at) - args.splice(i, 1, arg, v) - } - - // see if it's a shorthand - // if so, splice and back up to re-parse it. - var shRes = resolveShort(arg, shorthands, shortAbbr, abbrevs) - debug("arg=%j shRes=%j", arg, shRes) - if (shRes) { - debug(arg, shRes) - args.splice.apply(args, [i, 1].concat(shRes)) - if (arg !== shRes[0]) { - i -- - continue - } - } - arg = arg.replace(/^-+/, "") - var no = null - while (arg.toLowerCase().indexOf("no-") === 0) { - no = !no - arg = arg.substr(3) - } - - if (abbrevs[arg]) arg = abbrevs[arg] - - var argType = types[arg] - var isTypeArray = Array.isArray(argType) - if (isTypeArray && argType.length === 1) { - isTypeArray = false - argType = argType[0] - } - - var isArray = argType === Array || - isTypeArray && argType.indexOf(Array) !== -1 - - // allow unknown things to be arrays if specified multiple times. - if (!types.hasOwnProperty(arg) && data.hasOwnProperty(arg)) { - if (!Array.isArray(data[arg])) - data[arg] = [data[arg]] - isArray = true - } - - var val - , la = args[i + 1] - - var isBool = typeof no === 'boolean' || - argType === Boolean || - isTypeArray && argType.indexOf(Boolean) !== -1 || - (typeof argType === 'undefined' && !hadEq) || - (la === "false" && - (argType === null || - isTypeArray && ~argType.indexOf(null))) - - if (isBool) { - // just set and move along - val = !no - // however, also support --bool true or --bool false - if (la === "true" || la === "false") { - val = JSON.parse(la) - la = null - if (no) val = !val - i ++ - } - - // also support "foo":[Boolean, "bar"] and "--foo bar" - if (isTypeArray && la) { - if (~argType.indexOf(la)) { - // an explicit type - val = la - i ++ - } else if ( la === "null" && ~argType.indexOf(null) ) { - // null allowed - val = null - i ++ - } else if ( !la.match(/^-{2,}[^-]/) && - !isNaN(la) && - ~argType.indexOf(Number) ) { - // number - val = +la - i ++ - } else if ( !la.match(/^-[^-]/) && ~argType.indexOf(String) ) { - // string - val = la - i ++ - } - } - - if (isArray) (data[arg] = data[arg] || []).push(val) - else data[arg] = val - - continue - } - - if (argType === String) { - if (la === undefined) { - la = "" - } else if (la.match(/^-{1,2}[^-]+/)) { - la = "" - i -- - } - } - - if (la && la.match(/^-{2,}$/)) { - la = undefined - i -- - } - - val = la === undefined ? true : la - if (isArray) (data[arg] = data[arg] || []).push(val) - else data[arg] = val - - i ++ - continue - } - remain.push(arg) - } -} - -function resolveShort (arg, shorthands, shortAbbr, abbrevs) { - // handle single-char shorthands glommed together, like - // npm ls -glp, but only if there is one dash, and only if - // all of the chars are single-char shorthands, and it's - // not a match to some other abbrev. - arg = arg.replace(/^-+/, '') - - // if it's an exact known option, then don't go any further - if (abbrevs[arg] === arg) - return null - - // if it's an exact known shortopt, same deal - if (shorthands[arg]) { - // make it an array, if it's a list of words - if (shorthands[arg] && !Array.isArray(shorthands[arg])) - shorthands[arg] = shorthands[arg].split(/\s+/) - - return shorthands[arg] - } - - // first check to see if this arg is a set of single-char shorthands - var singles = shorthands.___singles - if (!singles) { - singles = Object.keys(shorthands).filter(function (s) { - return s.length === 1 - }).reduce(function (l,r) { - l[r] = true - return l - }, {}) - shorthands.___singles = singles - debug('shorthand singles', singles) - } - - var chrs = arg.split("").filter(function (c) { - return singles[c] - }) - - if (chrs.join("") === arg) return chrs.map(function (c) { - return shorthands[c] - }).reduce(function (l, r) { - return l.concat(r) - }, []) - - - // if it's an arg abbrev, and not a literal shorthand, then prefer the arg - if (abbrevs[arg] && !shorthands[arg]) - return null - - // if it's an abbr for a shorthand, then use that - if (shortAbbr[arg]) - arg = shortAbbr[arg] - - // make it an array, if it's a list of words - if (shorthands[arg] && !Array.isArray(shorthands[arg])) - shorthands[arg] = shorthands[arg].split(/\s+/) - - return shorthands[arg] -} diff --git a/node_modules/node-gyp/node_modules/nopt/package.json b/node_modules/node-gyp/node_modules/nopt/package.json deleted file mode 100644 index ac6e169ae..000000000 --- a/node_modules/node-gyp/node_modules/nopt/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "nopt", - "version": "4.0.3", - "description": "Option parsing for Node, supporting types, shorthands, etc. Used by npm.", - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", - "main": "lib/nopt.js", - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "prepublishOnly": "git push origin --follow-tags", - "test": "tap test/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/npm/nopt.git" - }, - "bin": "./bin/nopt.js", - "license": "ISC", - "dependencies": { - "abbrev": "1", - "osenv": "^0.1.4" - }, - "devDependencies": { - "tap": "^14.10.6" - }, - "files": [ - "bin", - "lib" - ] -} diff --git a/node_modules/node-gyp/node_modules/rimraf/LICENSE b/node_modules/node-gyp/node_modules/rimraf/LICENSE deleted file mode 100644 index 19129e315..000000000 --- a/node_modules/node-gyp/node_modules/rimraf/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/node-gyp/node_modules/rimraf/README.md b/node_modules/node-gyp/node_modules/rimraf/README.md deleted file mode 100644 index 423b8cf85..000000000 --- a/node_modules/node-gyp/node_modules/rimraf/README.md +++ /dev/null @@ -1,101 +0,0 @@ -[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) - -The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. - -Install with `npm install rimraf`, or just drop rimraf.js somewhere. - -## API - -`rimraf(f, [opts], callback)` - -The first parameter will be interpreted as a globbing pattern for files. If you -want to disable globbing you can do so with `opts.disableGlob` (defaults to -`false`). This might be handy, for instance, if you have filenames that contain -globbing wildcard characters. - -The callback will be called with an error if there is one. Certain -errors are handled for you: - -* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of - `opts.maxBusyTries` times before giving up, adding 100ms of wait - between each attempt. The default `maxBusyTries` is 3. -* `ENOENT` - If the file doesn't exist, rimraf will return - successfully, since your desired outcome is already the case. -* `EMFILE` - Since `readdir` requires opening a file descriptor, it's - possible to hit `EMFILE` if too many file descriptors are in use. - In the sync case, there's nothing to be done for this. But in the - async case, rimraf will gradually back off with timeouts up to - `opts.emfileWait` ms, which defaults to 1000. - -## options - -* unlink, chmod, stat, lstat, rmdir, readdir, - unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync - - In order to use a custom file system library, you can override - specific fs functions on the options object. - - If any of these functions are present on the options object, then - the supplied function will be used instead of the default fs - method. - - Sync methods are only relevant for `rimraf.sync()`, of course. - - For example: - - ```javascript - var myCustomFS = require('some-custom-fs') - - rimraf('some-thing', myCustomFS, callback) - ``` - -* maxBusyTries - - If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered - on Windows systems, then rimraf will retry with a linear backoff - wait of 100ms longer on each try. The default maxBusyTries is 3. - - Only relevant for async usage. - -* emfileWait - - If an `EMFILE` error is encountered, then rimraf will retry - repeatedly with a linear backoff of 1ms longer on each try, until - the timeout counter hits this max. The default limit is 1000. - - If you repeatedly encounter `EMFILE` errors, then consider using - [graceful-fs](http://npm.im/graceful-fs) in your program. - - Only relevant for async usage. - -* glob - - Set to `false` to disable [glob](http://npm.im/glob) pattern - matching. - - Set to an object to pass options to the glob module. The default - glob options are `{ nosort: true, silent: true }`. - - Glob version 6 is used in this module. - - Relevant for both sync and async usage. - -* disableGlob - - Set to any non-falsey value to disable globbing entirely. - (Equivalent to setting `glob: false`.) - -## rimraf.sync - -It can remove stuff synchronously, too. But that's not so good. Use -the async API. It's better. - -## CLI - -If installed with `npm install rimraf -g` it can be used as a global -command `rimraf <path> [<path> ...]` which is useful for cross platform support. - -## mkdirp - -If you need to create a directory recursively, check out -[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/node_modules/node-gyp/node_modules/rimraf/bin.js b/node_modules/node-gyp/node_modules/rimraf/bin.js deleted file mode 100755 index 0d1e17be7..000000000 --- a/node_modules/node-gyp/node_modules/rimraf/bin.js +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env node - -var rimraf = require('./') - -var help = false -var dashdash = false -var noglob = false -var args = process.argv.slice(2).filter(function(arg) { - if (dashdash) - return !!arg - else if (arg === '--') - dashdash = true - else if (arg === '--no-glob' || arg === '-G') - noglob = true - else if (arg === '--glob' || arg === '-g') - noglob = false - else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) - help = true - else - return !!arg -}) - -if (help || args.length === 0) { - // If they didn't ask for help, then this is not a "success" - var log = help ? console.log : console.error - log('Usage: rimraf <path> [<path> ...]') - log('') - log(' Deletes all files and folders at "path" recursively.') - log('') - log('Options:') - log('') - log(' -h, --help Display this usage info') - log(' -G, --no-glob Do not expand glob patterns in arguments') - log(' -g, --glob Expand glob patterns in arguments (default)') - process.exit(help ? 0 : 1) -} else - go(0) - -function go (n) { - if (n >= args.length) - return - var options = {} - if (noglob) - options = { glob: false } - rimraf(args[n], options, function (er) { - if (er) - throw er - go(n+1) - }) -} diff --git a/node_modules/node-gyp/node_modules/rimraf/package.json b/node_modules/node-gyp/node_modules/rimraf/package.json deleted file mode 100644 index 26e05d85e..000000000 --- a/node_modules/node-gyp/node_modules/rimraf/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "rimraf", - "version": "2.7.1", - "main": "rimraf.js", - "description": "A deep deletion module for node (like `rm -rf`)", - "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", - "license": "ISC", - "repository": "git://github.com/isaacs/rimraf.git", - "scripts": { - "preversion": "npm test", - "postversion": "npm publish", - "postpublish": "git push origin --all; git push origin --tags", - "test": "tap test/*.js" - }, - "bin": "./bin.js", - "dependencies": { - "glob": "^7.1.3" - }, - "files": [ - "LICENSE", - "README.md", - "bin.js", - "rimraf.js" - ], - "devDependencies": { - "mkdirp": "^0.5.1", - "tap": "^12.1.1" - } -} diff --git a/node_modules/node-gyp/node_modules/rimraf/rimraf.js b/node_modules/node-gyp/node_modules/rimraf/rimraf.js deleted file mode 100644 index a90ad029f..000000000 --- a/node_modules/node-gyp/node_modules/rimraf/rimraf.js +++ /dev/null @@ -1,372 +0,0 @@ -module.exports = rimraf -rimraf.sync = rimrafSync - -var assert = require("assert") -var path = require("path") -var fs = require("fs") -var glob = undefined -try { - glob = require("glob") -} catch (_err) { - // treat glob as optional. -} -var _0666 = parseInt('666', 8) - -var defaultGlobOpts = { - nosort: true, - silent: true -} - -// for EMFILE handling -var timeout = 0 - -var isWindows = (process.platform === "win32") - -function defaults (options) { - var methods = [ - 'unlink', - 'chmod', - 'stat', - 'lstat', - 'rmdir', - 'readdir' - ] - methods.forEach(function(m) { - options[m] = options[m] || fs[m] - m = m + 'Sync' - options[m] = options[m] || fs[m] - }) - - options.maxBusyTries = options.maxBusyTries || 3 - options.emfileWait = options.emfileWait || 1000 - if (options.glob === false) { - options.disableGlob = true - } - if (options.disableGlob !== true && glob === undefined) { - throw Error('glob dependency not found, set `options.disableGlob = true` if intentional') - } - options.disableGlob = options.disableGlob || false - options.glob = options.glob || defaultGlobOpts -} - -function rimraf (p, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert.equal(typeof cb, 'function', 'rimraf: callback function required') - assert(options, 'rimraf: invalid options argument provided') - assert.equal(typeof options, 'object', 'rimraf: options should be object') - - defaults(options) - - var busyTries = 0 - var errState = null - var n = 0 - - if (options.disableGlob || !glob.hasMagic(p)) - return afterGlob(null, [p]) - - options.lstat(p, function (er, stat) { - if (!er) - return afterGlob(null, [p]) - - glob(p, options.glob, afterGlob) - }) - - function next (er) { - errState = errState || er - if (--n === 0) - cb(errState) - } - - function afterGlob (er, results) { - if (er) - return cb(er) - - n = results.length - if (n === 0) - return cb() - - results.forEach(function (p) { - rimraf_(p, options, function CB (er) { - if (er) { - if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && - busyTries < options.maxBusyTries) { - busyTries ++ - var time = busyTries * 100 - // try again, with the same exact callback as this one. - return setTimeout(function () { - rimraf_(p, options, CB) - }, time) - } - - // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < options.emfileWait) { - return setTimeout(function () { - rimraf_(p, options, CB) - }, timeout ++) - } - - // already gone - if (er.code === "ENOENT") er = null - } - - timeout = 0 - next(er) - }) - }) - } -} - -// Two possible strategies. -// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR -// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR -// -// Both result in an extra syscall when you guess wrong. However, there -// are likely far more normal files in the world than directories. This -// is based on the assumption that a the average number of files per -// directory is >= 1. -// -// If anyone ever complains about this, then I guess the strategy could -// be made configurable somehow. But until then, YAGNI. -function rimraf_ (p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - - // sunos lets the root user unlink directories, which is... weird. - // so we have to lstat here and make sure it's not a dir. - options.lstat(p, function (er, st) { - if (er && er.code === "ENOENT") - return cb(null) - - // Windows can EPERM on stat. Life is suffering. - if (er && er.code === "EPERM" && isWindows) - fixWinEPERM(p, options, er, cb) - - if (st && st.isDirectory()) - return rmdir(p, options, er, cb) - - options.unlink(p, function (er) { - if (er) { - if (er.code === "ENOENT") - return cb(null) - if (er.code === "EPERM") - return (isWindows) - ? fixWinEPERM(p, options, er, cb) - : rmdir(p, options, er, cb) - if (er.code === "EISDIR") - return rmdir(p, options, er, cb) - } - return cb(er) - }) - }) -} - -function fixWinEPERM (p, options, er, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - if (er) - assert(er instanceof Error) - - options.chmod(p, _0666, function (er2) { - if (er2) - cb(er2.code === "ENOENT" ? null : er) - else - options.stat(p, function(er3, stats) { - if (er3) - cb(er3.code === "ENOENT" ? null : er) - else if (stats.isDirectory()) - rmdir(p, options, er, cb) - else - options.unlink(p, cb) - }) - }) -} - -function fixWinEPERMSync (p, options, er) { - assert(p) - assert(options) - if (er) - assert(er instanceof Error) - - try { - options.chmodSync(p, _0666) - } catch (er2) { - if (er2.code === "ENOENT") - return - else - throw er - } - - try { - var stats = options.statSync(p) - } catch (er3) { - if (er3.code === "ENOENT") - return - else - throw er - } - - if (stats.isDirectory()) - rmdirSync(p, options, er) - else - options.unlinkSync(p) -} - -function rmdir (p, options, originalEr, cb) { - assert(p) - assert(options) - if (originalEr) - assert(originalEr instanceof Error) - assert(typeof cb === 'function') - - // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) - // if we guessed wrong, and it's not a directory, then - // raise the original error. - options.rmdir(p, function (er) { - if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) - rmkids(p, options, cb) - else if (er && er.code === "ENOTDIR") - cb(originalEr) - else - cb(er) - }) -} - -function rmkids(p, options, cb) { - assert(p) - assert(options) - assert(typeof cb === 'function') - - options.readdir(p, function (er, files) { - if (er) - return cb(er) - var n = files.length - if (n === 0) - return options.rmdir(p, cb) - var errState - files.forEach(function (f) { - rimraf(path.join(p, f), options, function (er) { - if (errState) - return - if (er) - return cb(errState = er) - if (--n === 0) - options.rmdir(p, cb) - }) - }) - }) -} - -// this looks simpler, and is strictly *faster*, but will -// tie up the JavaScript thread and fail on excessively -// deep directory trees. -function rimrafSync (p, options) { - options = options || {} - defaults(options) - - assert(p, 'rimraf: missing path') - assert.equal(typeof p, 'string', 'rimraf: path should be a string') - assert(options, 'rimraf: missing options') - assert.equal(typeof options, 'object', 'rimraf: options should be object') - - var results - - if (options.disableGlob || !glob.hasMagic(p)) { - results = [p] - } else { - try { - options.lstatSync(p) - results = [p] - } catch (er) { - results = glob.sync(p, options.glob) - } - } - - if (!results.length) - return - - for (var i = 0; i < results.length; i++) { - var p = results[i] - - try { - var st = options.lstatSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - - // Windows can EPERM on stat. Life is suffering. - if (er.code === "EPERM" && isWindows) - fixWinEPERMSync(p, options, er) - } - - try { - // sunos lets the root user unlink directories, which is... weird. - if (st && st.isDirectory()) - rmdirSync(p, options, null) - else - options.unlinkSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "EPERM") - return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) - if (er.code !== "EISDIR") - throw er - - rmdirSync(p, options, er) - } - } -} - -function rmdirSync (p, options, originalEr) { - assert(p) - assert(options) - if (originalEr) - assert(originalEr instanceof Error) - - try { - options.rmdirSync(p) - } catch (er) { - if (er.code === "ENOENT") - return - if (er.code === "ENOTDIR") - throw originalEr - if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") - rmkidsSync(p, options) - } -} - -function rmkidsSync (p, options) { - assert(p) - assert(options) - options.readdirSync(p).forEach(function (f) { - rimrafSync(path.join(p, f), options) - }) - - // We only end up here once we got ENOTEMPTY at least once, and - // at this point, we are guaranteed to have removed all the kids. - // So, we know that it won't be ENOENT or ENOTDIR or anything else. - // try really hard to delete stuff on windows, because it has a - // PROFOUNDLY annoying habit of not closing handles promptly when - // files are deleted, resulting in spurious ENOTEMPTY errors. - var retries = isWindows ? 100 : 1 - var i = 0 - do { - var threw = true - try { - var ret = options.rmdirSync(p, options) - threw = false - return ret - } finally { - if (++i < retries && threw) - continue - } - } while (true) -} diff --git a/node_modules/node-gyp/package.json b/node_modules/node-gyp/package.json index fd286374a..b50ceb42b 100644 --- a/node_modules/node-gyp/package.json +++ b/node_modules/node-gyp/package.json @@ -11,7 +11,7 @@ "bindings", "gyp" ], - "version": "7.1.0", + "version": "7.1.1", "installVersion": 9, "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)", "repository": { @@ -25,12 +25,12 @@ "env-paths": "^2.2.0", "glob": "^7.1.4", "graceful-fs": "^4.2.3", - "nopt": "^4.0.3", + "nopt": "^5.0.0", "npmlog": "^4.1.2", "request": "^2.88.2", - "rimraf": "^2.6.3", + "rimraf": "^3.0.2", "semver": "^7.3.2", - "tar": "^6.0.1", + "tar": "^6.0.2", "which": "^2.0.2" }, "engines": { @@ -38,7 +38,7 @@ }, "devDependencies": { "bindings": "^1.5.0", - "nan": "^2.14.1", + "nan": "^2.14.2", "require-inject": "^1.4.4", "standard": "^14.3.4", "tap": "^12.7.0" diff --git a/node_modules/node-gyp/test/test-options.js b/node_modules/node-gyp/test/test-options.js index 252baa203..b2ac62c87 100644 --- a/node_modules/node-gyp/test/test-options.js +++ b/node_modules/node-gyp/test/test-options.js @@ -3,13 +3,19 @@ const test = require('tap').test const gyp = require('../lib/node-gyp') -test('options in environment', function (t) { +test('options in environment', (t) => { t.plan(1) // `npm test` dumps a ton of npm_config_* variables in the environment. Object.keys(process.env) - .filter(function (key) { return /^npm_config_/.test(key) }) - .forEach(function (key) { delete process.env[key] }) + .filter((key) => /^npm_config_/.test(key)) + .forEach((key) => { delete process.env[key] }) + + // in some platforms, certain keys are stubborn and cannot be removed + const keys = Object.keys(process.env) + .filter((key) => /^npm_config_/.test(key)) + .map((key) => key.substring('npm_config_'.length)) + .concat('argv', 'x') // Zero-length keys should get filtered out. process.env.npm_config_ = '42' @@ -18,8 +24,8 @@ test('options in environment', function (t) { // Except loglevel. process.env.npm_config_loglevel = 'debug' - var g = gyp() + const g = gyp() g.parseArgv(['rebuild']) // Also sets opts.argv. - t.deepEqual(Object.keys(g.opts).sort(), ['argv', 'x']) + t.deepEqual(Object.keys(g.opts).sort(), keys.sort()) }) |