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: v9.0.0
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: v9.1.0
Choose a head ref
  • 14 commits
  • 19 files changed
  • 8 contributors

Commits on Mar 1, 2022

  1. Copy the full SHA
    245cd5b View commit details

Commits on May 11, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    62d2815 View commit details
  2. fix: typo on readme

    rubiagatra authored and rvagg committed May 11, 2022
    Copy the full SHA
    bf81cd4 View commit details

Commits on May 12, 2022

  1. fix: new ca & server certs, bundle in .js file and unpack for testing

    bundling in certs.js rather than including the raw files should avoid some
    false positives that low-quality security scanners keep on complaining about.
    rvagg committed May 12, 2022
    Copy the full SHA
    147e3d3 View commit details
  2. Copy the full SHA
    6f74c76 View commit details

Commits on Jun 10, 2022

  1. Add Python symlink to path (for non-Windows OSes only) (#2362)

    * lib: create a Python symlink and add it to PATH
    
    Helps to ensure a version of Python validated by lib/find-python.js
    is used to run various Python scripts generated by gyp.
    
    Known to affect gyp-mac-tool, probably affects gyp-flock-tool as well.
    
    These Python scripts (such as `gyp-mac-tool`) are invoked directly,
    via the generated Makefile, so their shebang lines determine
    which Python binary is used to run them.
    The shebang lines of these scripts are all `#!/usr/bin/env python3`,
    so the first `python3` on the user's PATH will be used.
    
    By adding a symlink to the Python binary validated by find-python.js,
    and putting this symlink first on the PATH, we can ensure we use
    a compatible version of Python to run these scripts.
    
    (Only on Unix/Unix-like OSes. Symlinks are tricky on Windows,
    and Python isn't used at build-time anyhow on Windows,
    so this intervention isn't useful or necessary on Windows.
    
    A similar technique for Windows, no symlinks required,
    would be to make batch scripts which execute the target binary,
    much like what Node does for its bundled copy of npm on Windows.)
    
    * test: update mocked graceful-fs for configure test
    
    Add missing functions "unlink()" and "symlink()" to mocked module.
    
    * lib: log any errors when creating Python symlink
    
    Warn users about errors, but continue on in case the user does
    happen to have new enough Python on their PATH.
    
    (The symlinks are only meant to fix an issue in a corner case,
    where the user told `node-gyp` where new enough Python is,
    but it's not the first `python3` on their PATH.
    We should not introduce a new potential failure mode to all users
    when fixing this bug. So no hard errors during the symlink process.)
    
    * lib: improve error formatting for Python symlink
    
    Logging the entire error object shows the stack twice,
    and all the other information is contained in the stack.
    
    It also messes with the order of what is logged.
    
    Rather than logging a bunch of redundant information in a messy way,
    we can log only the stack. Logging it in a separate log.warn()
    also gets rid of an extra space character at the beginning of the line.
    
    * lib: restore err.errno to logs for symlink errors
    
    This info (err.errno) is the only piece of information
    in the error object that is not redundant to err.stack.
    
    * lib: use log.verbose, not log.warn
    
    These messages aren't important enough to be `log.warn`s.
    
    Log as verbose only; they will also appear in full error output.
    DeeDeeG authored Jun 10, 2022
    1
    Copy the full SHA
    b9ddcd5 View commit details
  2. 2
    Copy the full SHA
    d7687d5 View commit details

Commits on Jun 15, 2022

  1. Copy the full SHA
    ca1f068 View commit details

Commits on Jun 22, 2022

  1. Copy the full SHA
    9778dd0 View commit details

Commits on Jul 13, 2022

  1. Copy the full SHA
    ea8520e View commit details
  2. test: Upgrade GitHub Actions (#2701)

    * test: Upgrade GitHub Actions
    
    * node: 18x --> 18.x
    cclauss authored Jul 13, 2022
    Copy the full SHA
    1c64ca7 View commit details
  3. test: Try msvs-version: [2016, 2019, 2022] (#2700)

    * test: Try msvs-version: [2016, 2019, 2022]
    
    * main, not master
    
    * Don't npm audit fix --force
    cclauss authored Jul 13, 2022
    Copy the full SHA
    68b5b5b View commit details
  4. fix: re-label (#2689)

    cclauss authored Jul 13, 2022
    Copy the full SHA
    f0b7863 View commit details

Commits on Jul 14, 2022

  1. chore: release 9.1.0

    github-actions[bot] authored and rvagg committed Jul 14, 2022
    Copy the full SHA
    5f9d86d View commit details
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name: release-please
on:
push:
branches:
- master
- main

jobs:
release-please:
25 changes: 16 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,52 @@
# TODO: Line 43, enable pytest --doctest-modules
# 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

name: Tests
on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Tests:
strategy:
fail-fast: false
max-parallel: 15
matrix:
node: [12.x, 14.x, 16.x]
node: [14.x, 16.x, 18.x]
python: ["3.6", "3.8", "3.10"]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Use Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
env:
PYTHON_VERSION: ${{ matrix.python }}
PYTHON_VERSION: ${{ matrix.python }} # Why do this?
- name: Install Dependencies
run: |
npm install --no-progress
pip install flake8 pytest
- name: Set Windows environment
if: matrix.os == 'windows-latest'
if: startsWith(matrix.os, 'windows')
run: |
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
echo 'GYP_MSVS_OVERRIDE_PATH=C:\\Dummy' >> $Env:GITHUB_ENV
- name: Lint Python
if: matrix.os == 'ubuntu-latest'
if: startsWith(matrix.os, 'ubuntu')
run: flake8 . --ignore=E203,W503 --max-complexity=101 --max-line-length=88 --show-source --statistics
- 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
24 changes: 16 additions & 8 deletions .github/workflows/visual-studio.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: Tests on Windows
on: [push, pull_request]
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources

name: visual-studio
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Tests:
visual-studio:
strategy:
fail-fast: false
max-parallel: 15
max-parallel: 8
matrix:
os: [windows-2022]
os: [windows-latest]
msvs-version: [2016, 2019, 2022] # https://github.com/actions/virtual-environments/tree/main/images/win
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Dependencies
run: |
npm install --no-progress
# npm audit fix --force
- name: Set Windows environment
if: matrix.os == 'windows-latest'
if: startsWith(matrix.os, 'windows')
run: |
echo 'GYP_MSVS_VERSION=2015' >> $Env:GITHUB_ENV
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
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## [9.1.0](https://www.github.com/nodejs/node-gyp/compare/v9.0.0...v9.1.0) (2022-07-13)


### Features

* Update function getSDK() to support Windows 11 SDK ([#2565](https://www.github.com/nodejs/node-gyp/issues/2565)) ([ea8520e](https://www.github.com/nodejs/node-gyp/commit/ea8520e3855374bd15b6d001fe112d58a8d7d737))


### Bug Fixes

* extend tap timeout length to allow for slow CI ([6f74c76](https://www.github.com/nodejs/node-gyp/commit/6f74c762fe3c19bdd20245cb5c02e2dfa65d9451))
* new ca & server certs, bundle in .js file and unpack for testing ([147e3d3](https://www.github.com/nodejs/node-gyp/commit/147e3d34f44a97deb7aa507207680cf0f4e662a2))
* re-label ([#2689](https://www.github.com/nodejs/node-gyp/issues/2689)) ([f0b7863](https://www.github.com/nodejs/node-gyp/commit/f0b7863dadfa365afc173025ae95351aec79abd9))
* typo on readme ([bf81cd4](https://www.github.com/nodejs/node-gyp/commit/bf81cd452b931dd4dfa82762c23dd530a075d992))


### Doc

* update docs/README.md with latest version number ([62d2815](https://www.github.com/nodejs/node-gyp/commit/62d28151bf8266a34e1bcceeb25b4e6e2ae5ca5d))


### Core

* update due to rename of primary branch ([ca1f068](https://www.github.com/nodejs/node-gyp/commit/ca1f0681a5567ca8cd51acebccd37a633f19bc6a))


### Tests

* Try msvs-version: [2016, 2019, 2022] ([#2700](https://www.github.com/nodejs/node-gyp/issues/2700)) ([68b5b5b](https://www.github.com/nodejs/node-gyp/commit/68b5b5be9c94ac20c55e88654ff6f55234d7130a))
* Upgrade GitHub Actions ([#2623](https://www.github.com/nodejs/node-gyp/issues/2623)) ([245cd5b](https://www.github.com/nodejs/node-gyp/commit/245cd5bbe4441d4f05e88f2fa20a86425419b6af))
* Upgrade GitHub Actions ([#2701](https://www.github.com/nodejs/node-gyp/issues/2701)) ([1c64ca7](https://www.github.com/nodejs/node-gyp/commit/1c64ca7f4702c6eb43ecd16fbd67b5d939041621))

## [9.0.0](https://www.github.com/nodejs/node-gyp/compare/v8.4.1...v9.0.0) (2022-02-24)


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ Depending on your operating system, you will need to install:

### On macOS

**ATTENTION**: If your Mac has been _upgraded_ to macOS Catalina (10.15), please read [macOS_Catalina.md](macOS_Catalina.md).
**ATTENTION**: If your Mac has been _upgraded_ to macOS Catalina (10.15) or higher, please read [macOS_Catalina.md](macOS_Catalina.md).

* Python v3.7, v3.8, v3.9, or v3.10
* `XCode Command Line Tools` which will install `clang`, `clang++`, and `make`.
@@ -89,7 +89,7 @@ searching will be done.

### Build for Third Party Node.js Runtimes

When building modules for thid party Node.js runtimes like Electron, which have
When building modules for third party Node.js runtimes like Electron, which have
different build configurations from the official Node.js distribution, you
should use `--dist-url` or `--nodedir` flags to specify the headers of the
runtime to build for.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Versions of `node-gyp` that are earlier than v8.x.x
## Versions of `node-gyp` that are earlier than v9.x.x

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

2 changes: 1 addition & 1 deletion docs/Updating-npm-bundled-node-gyp.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

**Note: These instructions will be undone if you reinstall or upgrade npm or node! For a more permanent (and simpler) solution, see [Force-npm-to-use-global-node-gyp.md](Force-npm-to-use-global-node-gyp.md). (npm 6 or older only!)**

[Many issues](https://github.com/nodejs/node-gyp/labels/ERR%21%20node-gyp%20-v%20%3C%3D%20v5.1.0) are opened by users who are
[Many issues](https://github.com/nodejs/node-gyp/issues?q=label%3A"ERR!+node-gyp+-v+<%3D+v9.x.x") are opened by users who are
not running a [current version of node-gyp](https://github.com/nodejs/node-gyp/releases).

`npm` bundles its own, internal, copy of `node-gyp`. This internal copy is independent of any globally installed copy of node-gyp that
7 changes: 7 additions & 0 deletions lib/build.js
Original file line number Diff line number Diff line change
@@ -185,6 +185,13 @@ function build (gyp, argv, callback) {
}
}

if (!win) {
// Add build-time dependency symlinks (such as Python) to PATH
const buildBinsDir = path.resolve('build', 'node_gyp_bins')
process.env.PATH = `${buildBinsDir}:${process.env.PATH}`
log.verbose('bin symlinks', `adding symlinks (such as Python), at "${buildBinsDir}", to PATH`)
}

var proc = gyp.spawn(command, argv)
proc.on('exit', onExit)
}
25 changes: 24 additions & 1 deletion lib/configure.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ if (win) {
function configure (gyp, argv, callback) {
var python
var buildDir = path.resolve('build')
var buildBinsDir = path.join(buildDir, 'node_gyp_bins')
var configNames = ['config.gypi', 'common.gypi']
var configs = []
var nodeDir
@@ -73,7 +74,9 @@ function configure (gyp, argv, callback) {

function createBuildDir () {
log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir)
fs.mkdir(buildDir, { recursive: true }, function (err, isNew) {

const deepestBuildDirSubdirectory = win ? buildDir : buildBinsDir
fs.mkdir(deepestBuildDirSubdirectory, { recursive: true }, function (err, isNew) {
if (err) {
return callback(err)
}
@@ -84,11 +87,31 @@ function configure (gyp, argv, callback) {
findVisualStudio(release.semver, gyp.opts.msvs_version,
createConfigFile)
} else {
createPythonSymlink()
createConfigFile()
}
})
}

function createPythonSymlink () {
const symlinkDestination = path.join(buildBinsDir, 'python3')

log.verbose('python symlink', `creating symlink to "${python}" at "${symlinkDestination}"`)

fs.unlink(symlinkDestination, function (err) {
if (err && err.code !== 'ENOENT') {
log.verbose('python symlink', 'error when attempting to remove existing symlink')
log.verbose('python symlink', err.stack, 'errno: ' + err.errno)
}
fs.symlink(python, symlinkDestination, function (err) {
if (err) {
log.verbose('python symlink', 'error when attempting to create Python symlink')
log.verbose('python symlink', err.stack, 'errno: ' + err.errno)
}
})
})
}

function createConfigFile (err, vsInfo) {
if (err) {
return callback(err)
17 changes: 9 additions & 8 deletions lib/find-visualstudio.js
Original file line number Diff line number Diff line change
@@ -314,29 +314,30 @@ VisualStudioFinder.prototype = {
getSDK: function getSDK (info) {
const win8SDK = 'Microsoft.VisualStudio.Component.Windows81SDK'
const win10SDKPrefix = 'Microsoft.VisualStudio.Component.Windows10SDK.'
const win11SDKPrefix = 'Microsoft.VisualStudio.Component.Windows11SDK.'

var Win10SDKVer = 0
var Win10or11SDKVer = 0
info.packages.forEach((pkg) => {
if (!pkg.startsWith(win10SDKPrefix)) {
if (!pkg.startsWith(win10SDKPrefix) && !pkg.startsWith(win11SDKPrefix)) {
return
}
const parts = pkg.split('.')
if (parts.length > 5 && parts[5] !== 'Desktop') {
this.log.silly('- ignoring non-Desktop Win10SDK:', pkg)
this.log.silly('- ignoring non-Desktop Win10/11SDK:', pkg)
return
}
const foundSdkVer = parseInt(parts[4], 10)
if (isNaN(foundSdkVer)) {
// Microsoft.VisualStudio.Component.Windows10SDK.IpOverUsb
this.log.silly('- failed to parse Win10SDK number:', pkg)
this.log.silly('- failed to parse Win10/11SDK number:', pkg)
return
}
this.log.silly('- found Win10SDK:', foundSdkVer)
Win10SDKVer = Math.max(Win10SDKVer, foundSdkVer)
this.log.silly('- found Win10/11SDK:', foundSdkVer)
Win10or11SDKVer = Math.max(Win10or11SDKVer, foundSdkVer)
})

if (Win10SDKVer !== 0) {
return `10.0.${Win10SDKVer}.0`
if (Win10or11SDKVer !== 0) {
return `10.0.${Win10or11SDKVer}.0`
} else if (info.packages.indexOf(win8SDK) !== -1) {
this.log.silly('- found Win8SDK')
return '8.1'
2 changes: 1 addition & 1 deletion macOS_Catalina.md
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ If `ProductVersion` is less then `10.15` then this document is not for you. Norm
### The acid test
To see if `Xcode Command Line Tools` is installed in a way that will work with `node-gyp`, run:
```
curl -sL https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash
curl -sL https://github.com/nodejs/node-gyp/raw/main/macOS_Catalina_acid_test.sh | bash
```

If test succeeded, _you are done_! You should be ready to [install](https://github.com/nodejs/node-gyp#installation) `node-gyp`.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"bindings",
"gyp"
],
"version": "9.0.0",
"version": "9.1.0",
"installVersion": 9,
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",
"repository": {
@@ -45,6 +45,6 @@
},
"scripts": {
"lint": "standard */*.js test/**/*.js",
"test": "npm run lint && tap --timeout=120 test/test-*"
"test": "npm run lint && tap --timeout=600 test/test-*"
}
}
40 changes: 0 additions & 40 deletions test/fixtures/ca-bundle.crt

This file was deleted.

21 changes: 0 additions & 21 deletions test/fixtures/ca.crt

This file was deleted.

Loading