Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/node-gyp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 33391db3a0008eff8408890da6ab232f2f90fcab
Choose a base ref
...
head repository: nodejs/node-gyp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 9acb4c73675a67f3f660621e367024daaec1092c
Choose a head ref
Loading
Showing with 7,128 additions and 2,450 deletions.
  1. +1 −1 .github/ISSUE_TEMPLATE.md
  2. +2 −2 .github/PULL_REQUEST_TEMPLATE.md
  3. +41 −0 .github/scripts/check-engines.js
  4. +56 −44 .github/workflows/release-please.yml
  5. +101 −20 .github/workflows/tests.yml
  6. +15 −14 .github/workflows/visual-studio.yml
  7. +4 −3 .gitignore
  8. +15 −0 .npmignore
  9. +65 −0 CHANGELOG.md
  10. +1 −1 CONTRIBUTING.md
  11. +27 −23 README.md
  12. +27 −29 bin/node-gyp.js
  13. +1 −1 docs/README.md
  14. +0 −4 gyp/.flake8
  15. +7 −6 gyp/.github/workflows/Python_tests.yml
  16. +22 −7 gyp/.github/workflows/node-gyp.yml
  17. +3 −3 gyp/.github/workflows/nodejs-windows.yml
  18. +1 −0 gyp/AUTHORS
  19. +42 −0 gyp/CHANGELOG.md
  20. +23 −0 gyp/README.md
  21. +12 −14 gyp/pylib/gyp/MSVSNew.py
  22. +1 −1 gyp/pylib/gyp/MSVSProject.py
  23. +1 −1 gyp/pylib/gyp/MSVSSettings.py
  24. +4 −2 gyp/pylib/gyp/__init__.py
  25. +7 −14 gyp/pylib/gyp/common.py
  26. +5 −1 gyp/pylib/gyp/easy_xml.py
  27. +4 −0 gyp/pylib/gyp/easy_xml_test.py
  28. +11 −15 gyp/pylib/gyp/generator/analyzer.py
  29. +1 −1 gyp/pylib/gyp/generator/android.py
  30. +3 −6 gyp/pylib/gyp/generator/cmake.py
  31. +6 −3 gyp/pylib/gyp/generator/compile_commands_json.py
  32. +1 −4 gyp/pylib/gyp/generator/eclipse.py
  33. +5 −11 gyp/pylib/gyp/generator/make.py
  34. +39 −39 gyp/pylib/gyp/generator/msvs.py
  35. +2 −5 gyp/pylib/gyp/generator/ninja.py
  36. +2 −5 gyp/pylib/gyp/generator/xcode.py
  37. +21 −36 gyp/pylib/gyp/input.py
  38. +8 −17 gyp/pylib/gyp/msvs_emulation.py
  39. +4 −5 gyp/pylib/gyp/win_tool.py
  40. +3 −9 gyp/pylib/gyp/xcode_emulation.py
  41. +21 −20 gyp/pylib/gyp/xcodeproj_file.py
  42. +3 −0 gyp/pylib/packaging/LICENSE
  43. +177 −0 gyp/pylib/packaging/LICENSE.APACHE
  44. +23 −0 gyp/pylib/packaging/LICENSE.BSD
  45. +15 −0 gyp/pylib/packaging/__init__.py
  46. +108 −0 gyp/pylib/packaging/_elffile.py
  47. +252 −0 gyp/pylib/packaging/_manylinux.py
  48. +83 −0 gyp/pylib/packaging/_musllinux.py
  49. +359 −0 gyp/pylib/packaging/_parser.py
  50. +61 −0 gyp/pylib/packaging/_structures.py
  51. +192 −0 gyp/pylib/packaging/_tokenizer.py
  52. +252 −0 gyp/pylib/packaging/markers.py
  53. +825 −0 gyp/pylib/packaging/metadata.py
  54. 0 gyp/pylib/packaging/py.typed
  55. +90 −0 gyp/pylib/packaging/requirements.py
  56. +1,030 −0 gyp/pylib/packaging/specifiers.py
  57. +553 −0 gyp/pylib/packaging/tags.py
  58. +172 −0 gyp/pylib/packaging/utils.py
  59. +563 −0 gyp/pylib/packaging/version.py
  60. +83 −5 gyp/pyproject.toml
  61. +2 −2 gyp/tools/pretty_sln.py
  62. +1 −1 gyp/tools/pretty_vcproj.py
  63. +98 −91 lib/build.js
  64. +5 −5 lib/clean.js
  65. +127 −206 lib/configure.js
  66. +14 −11 lib/create-config-gypi.js
  67. +39 −0 lib/download.js
  68. +5 −5 lib/find-node-directory.js
  69. +128 −162 lib/find-python.js
  70. +101 −121 lib/find-visualstudio.js
  71. +27 −70 lib/install.js
  72. +14 −15 lib/list.js
  73. +169 −0 lib/log.js
  74. +147 −174 lib/node-gyp.js
  75. +22 −23 lib/process-release.js
  76. +1 −2 lib/rebuild.js
  77. +18 −21 lib/remove.js
  78. +62 −45 lib/util.js
  79. +0 −104 macOS_Catalina.md
  80. +11 −11 package.json
  81. +22 −1 test/common.js
  82. +46 −45 test/fixtures/certs.js
  83. +0 −140 test/process-exec-sync.js
  84. +0 −75 test/reporter.js
  85. +2 −2 test/simple-proxy.js
  86. +57 −75 test/test-addon.js
  87. +17 −21 test/test-configure-python.js
  88. +1 −2 test/test-create-config-gypi.js
  89. +21 −30 test/test-download.js
  90. +16 −16 test/test-find-accessible-sync.js
  91. +14 −14 test/test-find-node-directory.js
  92. +83 −121 test/test-find-python.js
  93. +300 −347 test/test-find-visualstudio.js
  94. +75 −102 test/test-install.js
  95. +9 −0 test/test-options.js
  96. +18 −18 test/test-process-release.js
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ provide the basic information we require.
-->

Please look thru your error log for the string `gyp info using node-gyp@` and if the version number is less than the [current release of node-gyp](https://github.com/nodejs/node-gyp/releases) then __please upgrade__ using the instructions at https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md and try your command again.
Please look thru your error log for the string `gyp info using node-gyp@` and if the version number is less than the [current release of node-gyp](https://github.com/nodejs/node-gyp/releases) then __please upgrade__ using the instructions at https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md and try your command again.

Requests for help with [`node-sass` are very common](https://github.com/nodejs/node-gyp/issues?q=label%3A%22Node+Sass+--%3E+Dart+Sass%22). Please be aware that this package is deprecated, you should seek alternatives and avoid opening new issues about it here.

4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!--
Thank you for your pull request. Please review the below requirements.
Contributor guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md
Contributor guide: https://github.com/nodejs/node/blob/main/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] `npm install && npm test` passes
- [ ] `npm install && npm run lint && npm test` passes
- [ ] tests are included <!-- Bug fixes and new features should include tests -->
- [ ] documentation is changed or added
- [ ] commit message follows [commit guidelines](https://github.com/googleapis/release-please#how-should-i-write-my-commits)
41 changes: 41 additions & 0 deletions .github/scripts/check-engines.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { join } = require('path')
const semver = require('semver')
const Arborist = require('@npmcli/arborist')

const run = async (path, useEngines) => {
const pkgPath = join(path, 'package.json')
const pkg = require(pkgPath)

const engines = useEngines || pkg.engines.node

const arb = new Arborist({ path })
const tree = await arb.loadActual({ forceActual: true })
const deps = await tree.querySelectorAll(`#${pkg.name} > .prod:attr(engines, [node])`)

const invalid = []
for (const dep of deps) {
const depEngines = dep.target.package.engines.node
if (!semver.subset(engines, depEngines)) {
invalid.push({
name: `${dep.name}@${dep.version}`,
location: dep.location,
engines: depEngines
})
}
}

if (invalid.length) {
const msg = 'The following production dependencies are not compatible with ' +
`\`engines.node: ${engines}\` found in \`${pkgPath}\`:\n` + invalid.map((dep) => [
`${dep.name}:`,
` engines.node: ${dep.engines}`,
` location: ${dep.location}`
].join('\n')).join('\n')
throw new Error(msg)
}
}

run(process.cwd(), ...process.argv.slice(2)).then(() => console.log('Success')).catch((err) => {
console.error(err)
process.exitCode = 1
})
100 changes: 56 additions & 44 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -4,53 +4,65 @@ on:
push:
branches:
- main
pull_request:

jobs:
release-please:
outputs:
pr: ${{ steps.release.outputs.pr }}
permissions:
contents: write # to create release commit (google-github-actions/release-please-action)
pull-requests: write # to create release PR (google-github-actions/release-please-action)

runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v2
id: release
with:
package-name: node-gyp
release-type: node
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"bin","section":"Core","hidden":false},
{"type":"gyp","section":"Core","hidden":false},
{"type":"lib","section":"Core","hidden":false},
{"type":"src","section":"Core","hidden":false},
{"type":"test","section":"Tests","hidden":false},
{"type":"build","section":"Core","hidden":false},
{"type":"clean","section":"Core","hidden":false},
{"type":"configure","section":"Core","hidden":false},
{"type":"install","section":"Core","hidden":false},
{"type":"list","section":"Core","hidden":false},
{"type":"rebuild","section":"Core","hidden":false},
{"type":"remove","section":"Core","hidden":false},
{"type":"deps","section":"Core","hidden":false},
{"type":"python","section":"Core","hidden":false},
{"type":"lin","section":"Core","hidden":false},
{"type":"linux","section":"Core","hidden":false},
{"type":"mac","section":"Core","hidden":false},
{"type":"macos","section":"Core","hidden":false},
{"type":"win","section":"Core","hidden":false},
{"type":"windows","section":"Core","hidden":false},
{"type":"zos","section":"Core","hidden":false},
{"type":"doc","section":"Doc","hidden":false},
{"type":"docs","section":"Doc","hidden":false},
{"type":"readme","section":"Doc","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":false},
{"type":"refactor","section":"Miscellaneous","hidden":false},
{"type":"ci","section":"Miscellaneous","hidden":false},
{"type":"meta","section":"Miscellaneous","hidden":false}]
- uses: google-github-actions/release-please-action@v2
id: release
with:
package-name: node-gyp
release-type: node
changelog-types: >
[{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"bin","section":"Core","hidden":false},
{"type":"gyp","section":"Core","hidden":false},
{"type":"lib","section":"Core","hidden":false},
{"type":"src","section":"Core","hidden":false},
{"type":"test","section":"Tests","hidden":false},
{"type":"build","section":"Core","hidden":false},
{"type":"clean","section":"Core","hidden":false},
{"type":"configure","section":"Core","hidden":false},
{"type":"install","section":"Core","hidden":false},
{"type":"list","section":"Core","hidden":false},
{"type":"rebuild","section":"Core","hidden":false},
{"type":"remove","section":"Core","hidden":false},
{"type":"deps","section":"Core","hidden":false},
{"type":"python","section":"Core","hidden":false},
{"type":"lin","section":"Core","hidden":false},
{"type":"linux","section":"Core","hidden":false},
{"type":"mac","section":"Core","hidden":false},
{"type":"macos","section":"Core","hidden":false},
{"type":"win","section":"Core","hidden":false},
{"type":"windows","section":"Core","hidden":false},
{"type":"zos","section":"Core","hidden":false},
{"type":"doc","section":"Doc","hidden":false},
{"type":"docs","section":"Doc","hidden":false},
{"type":"readme","section":"Doc","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":false},
{"type":"refactor","section":"Miscellaneous","hidden":false},
{"type":"ci","section":"Miscellaneous","hidden":false},
{"type":"meta","section":"Miscellaneous","hidden":false}]
# Standard Conventional Commits: `feat` and `fix`
# node-gyp subdirectories: `bin`, `gyp`, `lib`, `src`, `test`
# node-gyp subcommands: `build`, `clean`, `configure`, `install`, `list`, `rebuild`, `remove`
# Core abstract category: `deps`
# Languages/platforms: `python`, `lin`, `linux`, `mac`, `macos`, `win`, `window`, `zos`
# Documentation: `doc`, `docs`, `readme`
# Standard Conventional Commits: `chore` (under "Miscellaneous")
# Miscellaneous abstract categories: `refactor`, `ci`, `meta`

# Standard Conventional Commits: `feat` and `fix`
# node-gyp subdirectories: `bin`, `gyp`, `lib`, `src`, `test`
# node-gyp subcommands: `build`, `clean`, `configure`, `install`, `list`, `rebuild`, `remove`
# Core abstract category: `deps`
# Languages/platforms: `python`, `lin`, `linux`, `mac`, `macos`, `win`, `window`, `zos`
# Documentation: `doc`, `docs`, `readme`
# Standard Conventional Commits: `chore` (under "Miscellaneous")
# Miscellaneous abstract categories: `refactor`, `ci`, `meta`
test:
name: Release Test
needs: [ release-please ]
if: needs.release-please.outputs.pr
uses: ./.github/workflows/tests.yml
121 changes: 101 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,108 @@
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
# TODO: Line 48, enable pytest --doctest-modules
# TODO: add `python -m pytest --doctest-modules`

name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_call:

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
Lint_Python:
lint-python:
name: Lint Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: pip install --user ruff
- run: ruff --format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="PLC1901,S101,UP031" --target-version=py37 .
Tests:
- run: ruff --output-format=github --select="E,F,PLC,PLE,UP,W,YTT" --ignore="E721,PLC1901,S101,UP031" --target-version=py38 .

lint-js:
name: Lint JS
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Dependencies
run: npm install
- name: Lint
run: npm run lint

check-engines:
name: Check Engines
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Dependencies
run: npm install
- name: Check Engines
run: |
# TODO: move this to its own action
npm install @npmcli/arborist@7 semver@7 --no-save
node .github/scripts/check-engines.js
test-pack:
name: Test Pack
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Update npm
run: npm install npm@latest -g
- name: Install Dependencies
run: npm install
- name: Pack
id: pack
env:
NODE_GYP_TEMP_DIR: '${{ runner.temp }}/node-gyp'
run: |
mkdir -p $NODE_GYP_TEMP_DIR
npm pack
tar xzf *.tgz -C $NODE_GYP_TEMP_DIR --strip-components=1
cp -r test/ $NODE_GYP_TEMP_DIR/test/
echo "dir=$NODE_GYP_TEMP_DIR" >> "$GITHUB_OUTPUT"
- name: Test
working-directory: ${{ steps.pack.outputs.dir }}
env:
FULL_TEST: '1'
run: |
npm install
npm test
tests:
# lint-python takes ~5 seconds, so wait for it to pass before running the full matrix of tests.
needs: [lint-python]
strategy:
fail-fast: false
max-parallel: 15
matrix:
os: [macos, ubuntu, windows]
python: ["3.8", "3.10", "3.12"]
node: [16.x, 18.x, 20.x]
python: ["3.8", "3.11"]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} - ${{ matrix.python }} - ${{ matrix.node }}
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Use Python ${{ matrix.python }}
@@ -38,18 +113,24 @@ jobs:
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
- name: Install Dependencies
run: |
npm install --no-progress
npm install
pip install pytest
- name: Set Windows environment
if: startsWith(matrix.os, 'windows')
- name: Set Windows Env
if: runner.os == 'Windows'
run: |
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Run Python tests
- name: Run Python Tests
run: python -m pytest
# - name: Run doctests with pytest
# run: python -m pytest --doctest-modules
- name: Environment Information
run: npx envinfo
- name: Run Node tests
run: npm test
- name: Run Tests (macOS or Linux)
if: runner.os != 'Windows'
shell: bash
run: npm test --python="${pythonLocation}/python"
env:
FULL_TEST: ${{ (matrix.node == '20.x' && matrix.python == '3.12') && '1' || '0' }}
- name: Run Tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: npm run test --python="${env:pythonLocation}\\python.exe"
env:
FULL_TEST: ${{ (matrix.node == '20.x' && matrix.python == '3.12') && '1' || '0' }}
29 changes: 15 additions & 14 deletions .github/workflows/visual-studio.yml
Original file line number Diff line number Diff line change
@@ -6,28 +6,29 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read # to fetch code (actions/checkout)

jobs:
visual-studio:
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [windows-latest]
msvs-version: [2016, 2019, 2022] # https://github.com/actions/virtual-environments/tree/main/images/win
include:
- os: windows-2019
msvs-verison: 2019
- os: windows-2022
msvs-version: 2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Dependencies
run: |
npm install --no-progress
# npm audit fix --force
- name: Set Windows environment
if: startsWith(matrix.os, 'windows')
run: |
echo 'GYP_MSVS_VERSION=${{ matrix.msvs-version }}' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Environment Information
run: npx envinfo
run: npm install
- name: Run Node tests
run: npm test
shell: pwsh
run: |
$pythonLocation = (Get-Command python).Source
npm run test --python="${pythonLocation}" --msvs-version="${{ matrix.msvs-version }}"
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.ncu
.nyc_output
*.swp
gyp/test
node_modules
test/.node-gyp
.ncu
.nyc_output
node-gyp-*.tgz
package-lock.json
test/.node-gyp
Loading