Socket
Socket
Sign inDemoInstall

node-gyp

Package Overview
Dependencies
97
Maintainers
4
Versions
144
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0 to 5.0.0

.eslintrc.yaml

7

.github/ISSUE_TEMPLATE.md

@@ -17,6 +17,7 @@ <!--

<!-- Paste your log between the backticks. Contents of npm-debug.log or verbose build output -->
```
Paste your log here, between the backticks. It can be:
- npm --verbose output,
- or contents of npm-debug.log,
- or output of node-gyp rebuild --verbose.
```

@@ -23,0 +24,0 @@

#!/usr/bin/env node
/**
* Set the title.
*/
process.title = 'node-gyp'
/**
* Module dependencies.
*/
var envPaths = require('env-paths')
var gyp = require('../')
var log = require('npmlog')
var osenv = require('osenv')
var path = require('path')
var os = require('os')

@@ -27,7 +19,7 @@ /**

var homeDir = osenv.home()
var homeDir = os.homedir()
if (prog.devDir) {
prog.devDir = prog.devDir.replace(/^~/, homeDir)
} else if (homeDir) {
prog.devDir = path.resolve(homeDir, '.node-gyp')
prog.devDir = envPaths('node-gyp', { suffix: '' }).cache
} else {

@@ -46,3 +38,3 @@ throw new Error(

}
return process.exit(0)
process.exit(0)
}

@@ -131,3 +123,3 @@

function errorMessage () {
// copied from npm's lib/util/error-handler.js
// copied from npm's lib/utils/error-handler.js
var os = require('os')

@@ -134,0 +126,0 @@ log.error('System', os.type() + ' ' + os.release())

@@ -0,1 +1,40 @@

v5.0.0 2019-06-13
=================
* [[`8a83972743`](https://github.com/nodejs/node-gyp/commit/8a83972743)] - **(SEMVER-MAJOR)** **bin**: follow XDG OS conventions for storing data (Selwyn) [#1570](https://github.com/nodejs/node-gyp/pull/1570)
* [[`9e46872ea3`](https://github.com/nodejs/node-gyp/commit/9e46872ea3)] - **bin,lib**: remove extra comments/lines/spaces (Jon Moss) [#1508](https://github.com/nodejs/node-gyp/pull/1508)
* [[`8098ebdeb4`](https://github.com/nodejs/node-gyp/commit/8098ebdeb4)] - **deps**: replace `osenv` dependency with native `os` (Selwyn)
* [[`f83b457e03`](https://github.com/nodejs/node-gyp/commit/f83b457e03)] - **deps**: bump request to 2.8.7, fixes heok/hawk issues (Rohit Hazra) [#1492](https://github.com/nodejs/node-gyp/pull/1492)
* [[`323cee7323`](https://github.com/nodejs/node-gyp/commit/323cee7323)] - **deps**: pin `request` version range (Refael Ackermann) [#1300](https://github.com/nodejs/node-gyp/pull/1300)
* [[`c515912d08`](https://github.com/nodejs/node-gyp/commit/c515912d08)] - **doc**: improve issue template (Bartosz Sosnowski) [#1618](https://github.com/nodejs/node-gyp/pull/1618)
* [[`cca2d66727`](https://github.com/nodejs/node-gyp/commit/cca2d66727)] - **doc**: python info needs own header (Taylor D. Lee) [#1245](https://github.com/nodejs/node-gyp/pull/1245)
* [[`3e64c780f5`](https://github.com/nodejs/node-gyp/commit/3e64c780f5)] - **doc**: lint README.md (Jon Moss) [#1498](https://github.com/nodejs/node-gyp/pull/1498)
* [[`a20faedc91`](https://github.com/nodejs/node-gyp/commit/a20faedc91)] - **(SEMVER-MAJOR)** **gyp**: enable MARMASM items only on new VS versions (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
* [[`721eb691cf`](https://github.com/nodejs/node-gyp/commit/721eb691cf)] - **gyp**: teach MSVS generator about MARMASM Items (Jon Kunkee) [#1679](https://github.com/nodejs/node-gyp/pull/1679)
* [[`91744bfecc`](https://github.com/nodejs/node-gyp/commit/91744bfecc)] - **gyp**: add support for Windows on Arm (Richard Townsend) [#1739](https://github.com/nodejs/node-gyp/pull/1739)
* [[`a6e0a6c7ed`](https://github.com/nodejs/node-gyp/commit/a6e0a6c7ed)] - **gyp**: move compile\_commands\_json (Paul Maréchal) [#1661](https://github.com/nodejs/node-gyp/pull/1661)
* [[`92e8b52cee`](https://github.com/nodejs/node-gyp/commit/92e8b52cee)] - **gyp**: fix target --\> self.target (cclauss)
* [[`febdfa2137`](https://github.com/nodejs/node-gyp/commit/febdfa2137)] - **gyp**: fix sntex error (cclauss) [#1333](https://github.com/nodejs/node-gyp/pull/1333)
* [[`588d333c14`](https://github.com/nodejs/node-gyp/commit/588d333c14)] - **gyp**: \_winreg module was renamed to winreg in Python 3. (Craig Rodrigues)
* [[`98226d198c`](https://github.com/nodejs/node-gyp/commit/98226d198c)] - **gyp**: replace basestring with str, but only on Python 3. (Craig Rodrigues)
* [[`7535e4478e`](https://github.com/nodejs/node-gyp/commit/7535e4478e)] - **gyp**: replace deprecated functions (Craig Rodrigues)
* [[`2040cd21cc`](https://github.com/nodejs/node-gyp/commit/2040cd21cc)] - **gyp**: use print as a function, as specified in PEP 3105. (Craig Rodrigues)
* [[`abef93ded5`](https://github.com/nodejs/node-gyp/commit/abef93ded5)] - **gyp**: get ready for python 3 (cclauss)
* [[`43031fadcb`](https://github.com/nodejs/node-gyp/commit/43031fadcb)] - **python**: clean-up detection (João Reis) [#1582](https://github.com/nodejs/node-gyp/pull/1582)
* [[`49ab79d221`](https://github.com/nodejs/node-gyp/commit/49ab79d221)] - **python**: more informative error (Refael Ackermann) [#1269](https://github.com/nodejs/node-gyp/pull/1269)
* [[`997bc3c748`](https://github.com/nodejs/node-gyp/commit/997bc3c748)] - **readme**: add ARM64 info to MSVC setup instructions (Jon Kunkee) [#1655](https://github.com/nodejs/node-gyp/pull/1655)
* [[`788e767179`](https://github.com/nodejs/node-gyp/commit/788e767179)] - **test**: remove unused variable (João Reis)
* [[`6f5a408934`](https://github.com/nodejs/node-gyp/commit/6f5a408934)] - **tools**: fix usage of inherited -fPIC and -fPIE (Jens) [#1340](https://github.com/nodejs/node-gyp/pull/1340)
* [[`0efb8fb34b`](https://github.com/nodejs/node-gyp/commit/0efb8fb34b)] - **(SEMVER-MAJOR)** **win**: support running in VS Command Prompt (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
* [[`360ddbdf3a`](https://github.com/nodejs/node-gyp/commit/360ddbdf3a)] - **(SEMVER-MAJOR)** **win**: add support for Visual Studio 2019 (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
* [[`8f43f68275`](https://github.com/nodejs/node-gyp/commit/8f43f68275)] - **(SEMVER-MAJOR)** **win**: detect all VS versions in node-gyp (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
* [[`7fe4095974`](https://github.com/nodejs/node-gyp/commit/7fe4095974)] - **(SEMVER-MAJOR)** **win**: generic Visual Studio 2017 detection (João Reis) [#1762](https://github.com/nodejs/node-gyp/pull/1762)
* [[`7a71d68bce`](https://github.com/nodejs/node-gyp/commit/7a71d68bce)] - **win**: use msbuild from the configure stage (Bartosz Sosnowski) [#1654](https://github.com/nodejs/node-gyp/pull/1654)
* [[`d3b21220a0`](https://github.com/nodejs/node-gyp/commit/d3b21220a0)] - **win**: fix delay-load hook for electron 4 (Andy Dill)
* [[`81f3a92338`](https://github.com/nodejs/node-gyp/commit/81f3a92338)] - Update list of Node.js versions to test against. (Ben Noordhuis) [#1670](https://github.com/nodejs/node-gyp/pull/1670)
* [[`4748f6ab75`](https://github.com/nodejs/node-gyp/commit/4748f6ab75)] - Remove deprecated compatibility code. (Ben Noordhuis) [#1670](https://github.com/nodejs/node-gyp/pull/1670)
* [[`45e3221fd4`](https://github.com/nodejs/node-gyp/commit/45e3221fd4)] - Remove an outdated workaround for Python 2.4 (cclauss) [#1650](https://github.com/nodejs/node-gyp/pull/1650)
* [[`721dc7d314`](https://github.com/nodejs/node-gyp/commit/721dc7d314)] - Add ARM64 to MSBuild /Platform logic (Jon Kunkee) [#1655](https://github.com/nodejs/node-gyp/pull/1655)
* [[`a5b7410497`](https://github.com/nodejs/node-gyp/commit/a5b7410497)] - Add ESLint no-unused-vars rule (Jon Moss) [#1497](https://github.com/nodejs/node-gyp/pull/1497)
v4.0.0 2019-04-24

@@ -2,0 +41,0 @@ =================

module.exports = exports = build
/**
* Module dependencies.
*/
var fs = require('graceful-fs')
, rm = require('rimraf')
, path = require('path')

@@ -14,4 +9,2 @@ , glob = require('glob')

, which = require('which')
, exec = require('child_process').exec
, processRelease = require('./process-release')
, win = process.platform === 'win32'

@@ -33,7 +26,4 @@

var release = processRelease(argv, gyp, process.version, process.release)
, makeCommand = gyp.opts.make || process.env.MAKE || platformMake
var makeCommand = gyp.opts.make || process.env.MAKE || platformMake
, command = win ? 'msbuild' : makeCommand
, buildDir = path.resolve('build')
, configPath = path.resolve(buildDir, 'config.gypi')
, jobs = gyp.opts.jobs || process.env.JOBS

@@ -52,2 +42,3 @@ , buildType

function loadConfigGypi () {
var configPath = path.resolve('build', 'config.gypi')
fs.readFile(configPath, 'utf8', function (err, data) {

@@ -109,25 +100,8 @@ if (err) {

function doWhich () {
// First make sure we have the build command in the PATH
which(command, function (err, execPath) {
if (err) {
if (win && /not found/.test(err.message)) {
// On windows and no 'msbuild' found. Let's guess where it is
findMsbuild()
} else {
// Some other error or 'make' not found on Unix, report that to the user
callback(err)
}
return
// On Windows use msbuild provided by node-gyp configure
if (win) {
if (!config.variables.msbuild_path) {
return callback(new Error(
'MSBuild is not set, please run `node-gyp configure`.'))
}
log.verbose('`which` succeeded for `' + command + '`', execPath)
doBuild()
})
}
/**
* Search for the location of "msbuild.exe" file on Windows.
*/
function findMsbuild () {
if (config.variables.msbuild_path) {
command = config.variables.msbuild_path

@@ -138,59 +112,14 @@ log.verbose('using MSBuild:', command)

}
log.verbose('could not find "msbuild.exe" in PATH - finding location in registry')
var notfoundErr = 'Can\'t find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?'
var cmd = 'reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
if (process.arch !== 'ia32')
cmd += ' /reg:32'
exec(cmd, function (err, stdout, stderr) {
// First make sure we have the build command in the PATH
which(command, function (err, execPath) {
if (err) {
return callback(new Error(err.message + '\n' + notfoundErr))
// Some other error or 'make' not found on Unix, report that to the user
callback(err)
return
}
var reVers = /ToolsVersions\\([^\\]+)$/i
, rePath = /\r\n[ \t]+MSBuildToolsPath[ \t]+REG_SZ[ \t]+([^\r]+)/i
, msbuilds = []
, r
, msbuildPath
stdout.split('\r\n\r\n').forEach(function(l) {
if (!l) return
l = l.trim()
if (r = reVers.exec(l.substring(0, l.indexOf('\r\n')))) {
var ver = parseFloat(r[1], 10)
if (ver >= 3.5) {
if (r = rePath.exec(l)) {
msbuilds.push({
version: ver,
path: r[1]
})
}
}
}
})
msbuilds.sort(function (x, y) {
return (x.version < y.version ? -1 : 1)
})
;(function verifyMsbuild () {
if (!msbuilds.length) return callback(new Error(notfoundErr))
msbuildPath = path.resolve(msbuilds.pop().path, 'msbuild.exe')
fs.stat(msbuildPath, function (err, stat) {
if (err) {
if (err.code == 'ENOENT') {
if (msbuilds.length) {
return verifyMsbuild()
} else {
callback(new Error(notfoundErr))
}
} else {
callback(err)
}
return
}
command = msbuildPath
doBuild()
})
})()
log.verbose('`which` succeeded for `' + command + '`', execPath)
doBuild()
})
}
/**

@@ -201,3 +130,2 @@ * Actually spawn the process and compile the module.

function doBuild () {
// Enable Verbose build

@@ -219,5 +147,9 @@ var verbose = log.levels[log.level] <= log.levels.verbose

if (win) {
// Convert .gypi config target_arch to MSBuild /Platform
// Since there are many ways to state '32-bit Intel', default to it.
// N.B. msbuild's Condition string equality tests are case-insensitive.
var archLower = arch.toLowerCase()
var p = archLower === 'x64' ? 'x64' :
(archLower === 'arm' ? 'ARM' : 'Win32')
(archLower === 'arm' ? 'ARM' :
(archLower === 'arm64' ? 'ARM64' : 'Win32'))
argv.push('/p:Configuration=' + buildType + ';Platform=' + p)

@@ -263,6 +195,2 @@ if (jobs) {

/**
* Invoked after the make/msbuild command exits.
*/
function onExit (code, signal) {

@@ -277,3 +205,2 @@ if (code !== 0) {

}
}

@@ -6,12 +6,6 @@

/**
* Module dependencies.
*/
var rm = require('rimraf')
var log = require('npmlog')
function clean (gyp, argv, callback) {
// Remove the 'build' dir

@@ -22,3 +16,2 @@ var buildDir = 'build'

rm(buildDir, callback)
}

@@ -8,11 +8,6 @@ module.exports = exports = configure

/**
* Module dependencies.
*/
var fs = require('graceful-fs')
, path = require('path')
, log = require('npmlog')
, osenv = require('osenv')
, which = require('which')
, os = require('os')
, semver = require('semver')

@@ -26,4 +21,5 @@ , mkdirp = require('mkdirp')

, msgFormat = require('util').format
, logWithPrefix = require('./util').logWithPrefix
if (win)
var findVS2017 = require('./find-vs2017')
var findVisualStudio = require('./find-visualstudio')

@@ -33,4 +29,3 @@ exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module'

function configure (gyp, argv, callback) {
var python = gyp.opts.python || process.env.PYTHON || 'python2'
var python
, buildDir = path.resolve('build')

@@ -42,3 +37,3 @@ , configNames = [ 'config.gypi', 'common.gypi' ]

findPython(python, function (err, found) {
findPython(gyp.opts.python, function (err, found) {
if (err) {

@@ -53,3 +48,2 @@ callback(err)

function getNodeDir () {
// 'python' should be set by now

@@ -60,7 +54,6 @@ process.env.PYTHON = python

// --nodedir was specified. use that for the dev files
nodeDir = gyp.opts.nodedir.replace(/^~/, osenv.home())
nodeDir = gyp.opts.nodedir.replace(/^~/, os.homedir())
log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir)
createBuildDir()
} else {

@@ -85,3 +78,3 @@ // if no --nodedir specified, ensure node dependencies are installed

gyp.commands.install([ release.version ], function (err, version) {
gyp.commands.install([ release.version ], function (err) {
if (err) return callback(err)

@@ -100,11 +93,5 @@ log.verbose('get node dir', 'target node version installed:', release.versionDir)

log.verbose('build dir', '"build" dir needed to be created?', isNew)
if (win && (!gyp.opts.msvs_version || gyp.opts.msvs_version === '2017')) {
findVS2017(function (err, vsSetup) {
if (err) {
log.verbose('Not using VS2017:', err.message)
createConfigFile()
} else {
createConfigFile(null, vsSetup)
}
})
if (win) {
findVisualStudio(release.semver, gyp.opts.msvs_version,
createConfigFile)
} else {

@@ -116,3 +103,3 @@ createConfigFile()

function createConfigFile (err, vsSetup) {
function createConfigFile (err, vsInfo) {
if (err) return callback(err)

@@ -154,2 +141,5 @@

variables.target_arch = gyp.opts.arch || process.arch || 'ia32'
if (variables.target_arch == 'arm64') {
defaults['msvs_configuration_platform'] = 'ARM64'
}

@@ -162,13 +152,19 @@ // set the node development directory

if (vsSetup) {
// GYP doesn't (yet) have support for VS2017, so we force it to VS2015
// to avoid pulling a floating patch that has not landed upstream.
// Ref: https://chromium-review.googlesource.com/#/c/433540/
gyp.opts.msvs_version = '2015'
process.env['GYP_MSVS_VERSION'] = 2015
process.env['GYP_MSVS_OVERRIDE_PATH'] = vsSetup.path
defaults['msbuild_toolset'] = 'v141'
defaults['msvs_windows_target_platform_version'] = vsSetup.sdk
variables['msbuild_path'] = path.join(vsSetup.path, 'MSBuild', '15.0',
'Bin', 'MSBuild.exe')
if (win) {
process.env['GYP_MSVS_VERSION'] = Math.min(vsInfo.versionYear, 2015)
process.env['GYP_MSVS_OVERRIDE_PATH'] = vsInfo.path
defaults['msbuild_toolset'] = vsInfo.toolset
if (vsInfo.sdk) {
defaults['msvs_windows_target_platform_version'] = vsInfo.sdk
}
if (variables.target_arch == 'arm64') {
if (vsInfo.versionMajor > 15 ||
(vsInfo.versionMajor === 15 && vsInfo.versionMajor >= 9)) {
defaults['msvs_enable_marmasm'] = 1
} else {
log.warn('Compiling ARM64 assembly is only available in\n' +
'Visual Studio 2017 version 15.9 and above')
}
}
variables['msbuild_path'] = vsInfo.msBuild
}

@@ -209,3 +205,3 @@

log.verbose(name, 'checking for gypi file: %s', fullPath)
fs.stat(fullPath, function (err, stat) {
fs.stat(fullPath, function (err) {
if (err) {

@@ -240,16 +236,2 @@ if (err.code == 'ENOENT') {

function hasMsvsVersion () {
return argv.some(function (arg) {
return arg.indexOf('msvs_version') === 0
})
}
if (win && !hasMsvsVersion()) {
if ('msvs_version' in gyp.opts) {
argv.push('-G', 'msvs_version=' + gyp.opts.msvs_version)
} else {
argv.push('-G', 'msvs_version=auto')
}
}
// include all the ".gypi" files that were found

@@ -261,3 +243,3 @@ configs.forEach(function (config) {

// For AIX and z/OS we need to set up the path to the exports file
// which contains the symbols needed for linking.
// which contains the symbols needed for linking.
var node_exp_file = undefined

@@ -267,3 +249,3 @@ if (process.platform === 'aix' || process.platform === 'os390') {

var node_root_dir = findNodeDirectory()
var candidates = undefined
var candidates = undefined
if (process.platform === 'aix') {

@@ -300,3 +282,3 @@ candidates = ['include/node/node',

var common_gypi = path.resolve(nodeDir, 'include/node/common.gypi')
fs.stat(common_gypi, function (err, stat) {
fs.stat(common_gypi, function (err) {
if (err)

@@ -355,7 +337,3 @@ common_gypi = path.resolve(nodeDir, 'common.gypi')

/**
* Called when the `gyp` child process exits.
*/
function onCpExit (code, signal) {
function onCpExit (code) {
if (code !== 0) {

@@ -394,44 +372,152 @@ callback(new Error('`gyp` failed with exit code: ' + code))

function PythonFinder(python, callback) {
function PythonFinder(configPython, callback) {
this.callback = callback
this.python = python
this.configPython = configPython
this.errorLog = []
}
PythonFinder.prototype = {
checkPythonLauncherDepth: 0,
log: logWithPrefix(log, 'find Python'),
argsExecutable: ['-c', 'import sys; print(sys.executable);'],
argsVersion: ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);'],
semverRange: '>=2.6.0 <3.0.0',
// These can be overridden for testing:
execFile: cp.execFile,
env: process.env,
execFile: cp.execFile,
log: log,
resolve: path.win32 && path.win32.resolve || path.resolve,
stat: fs.stat,
which: which,
win: win,
pyLauncher: 'py.exe',
defaultLocation: path.join(process.env.SystemDrive || 'C:', 'Python27',
'python.exe'),
checkPython: function checkPython () {
this.log.verbose('check python',
'checking for Python executable "%s" in the PATH',
this.python)
this.which(this.python, function (err, execPath) {
// Logs a message at verbose level, but also saves it to be displayed later
// at error level if an error occurs. This should help diagnose the problem.
addLog: function addLog(message) {
this.log.verbose(message)
this.errorLog.push(message)
},
// Find Python by trying a sequence of possibilities.
// Ignore errors, keep trying until Python is found.
findPython: function findPython() {
const SKIP=0, FAIL=1
const toCheck = [
{
before: () => {
if (!this.configPython) {
this.addLog(
'Python is not set from command line or npm configuration')
return SKIP
}
this.addLog('checking Python explicitly set from command line or ' +
'npm configuration')
this.addLog('- "--python=" or "npm config get python" is ' +
`"${this.configPython}"`)
},
check: this.checkCommand,
arg: this.configPython,
},
{
before: () => {
if (!this.env.PYTHON) {
this.addLog('Python is not set from environment variable PYTHON')
return SKIP
}
this.addLog(
'checking Python explicitly set from environment variable PYTHON')
this.addLog(`- process.env.PYTHON is "${this.env.PYTHON}"`)
},
check: this.checkCommand,
arg: this.env.PYTHON,
},
{
before: () => { this.addLog('checking if "python2" can be used') },
check: this.checkCommand,
arg: 'python2',
},
{
before: () => { this.addLog('checking if "python" can be used') },
check: this.checkCommand,
arg: 'python',
},
{
before: () => {
if (!this.win) {
// Everything after this is Windows specific
return FAIL
}
this.addLog(
'checking if the py launcher can be used to find Python 2')
},
check: this.checkPyLauncher,
},
{
before: () => {
this.addLog(
'checking if Python 2 is installed in the default location')
},
check: this.checkExecPath,
arg: this.defaultLocation,
},
]
function runChecks(err) {
this.log.silly('runChecks: err = %j', err && err.stack || err)
const check = toCheck.shift()
if (!check) {
return this.fail()
}
const before = check.before.apply(this)
if (before === SKIP) {
return runChecks.apply(this)
}
if (before === FAIL) {
return this.fail()
}
const args = [ runChecks.bind(this) ]
if (check.arg) {
args.unshift(check.arg)
}
check.check.apply(this, args)
}
runChecks.apply(this)
},
// Check if command is a valid Python to use.
// Will exit the Python finder on success.
// If on Windows, run in a CMD shell to support BAT/CMD launchers.
checkCommand: function checkCommand (command, errorCallback) {
var exec = command
var args = this.argsExecutable
var shell = false
if (this.win) {
// Arguments have to be manually quoted
exec = `"${exec}"`
args = args.map(a => `"${a}"`)
shell = true
}
this.log.verbose(`- executing "${command}" to get executable path`)
this.run(exec, args, shell, function (err, execPath) {
// Possible outcomes:
// - Error: not in PATH, not executable or execution fails
// - Gibberish: the next command to check version will fail
// - Absolute path to executable
if (err) {
this.log.verbose('`which` failed', this.python, err)
if (this.python === 'python2') {
this.python = 'python'
return this.checkPython()
}
if (this.win) {
this.checkPythonLauncher()
} else {
this.failNoPython()
}
} else {
this.log.verbose('`which` succeeded', this.python, execPath)
// Found the `python` executable, and from now on we use it explicitly.
// This solves #667 and #750 (`execFile` won't run batch files
// (*.cmd, and *.bat))
this.python = execPath
this.checkPythonVersion()
this.addLog(`- "${command}" is not in PATH or produced an error`)
return errorCallback(err)
}
this.addLog(`- executable path is "${execPath}"`)
this.checkExecPath(execPath, errorCallback)
}.bind(this))
},
// Check if the py launcher can find a valid Python to use.
// Will exit the Python finder on success.
// Distributions of Python on Windows by default install with the "py.exe"

@@ -445,99 +531,122 @@ // Python launcher which is more likely to exist than the Python executable

// where the actual "python.exe" executable is located.
checkPythonLauncher: function checkPythonLauncher () {
this.checkPythonLauncherDepth += 1
checkPyLauncher: function checkPyLauncher (errorCallback) {
this.log.verbose(
'could not find "' + this.python + '". checking python launcher')
var env = extend({}, this.env)
env.TERM = 'dumb'
var launcherArgs = ['-2', '-c', 'import sys; print sys.executable']
this.execFile('py.exe', launcherArgs, { env: env }, function (err, stdout) {
`- executing "${this.pyLauncher}" to get Python 2 executable path`)
this.run(this.pyLauncher, ['-2', ...this.argsExecutable], false,
function (err, execPath) {
// Possible outcomes: same as checkCommand
if (err) {
this.guessPython()
} else {
this.python = stdout.trim()
this.log.verbose('check python launcher',
'python executable found: %j',
this.python)
this.checkPythonVersion()
this.addLog(
`- "${this.pyLauncher}" is not in PATH or produced an error`)
return errorCallback(err)
}
this.checkPythonLauncherDepth -= 1
this.addLog(`- executable path is "${execPath}"`)
this.checkExecPath(execPath, errorCallback)
}.bind(this))
},
checkPythonVersion: function checkPythonVersion () {
var args = ['-c', 'import sys; print("%s.%s.%s" % sys.version_info[:3]);']
var env = extend({}, this.env)
env.TERM = 'dumb'
this.execFile(this.python, args, { env: env }, function (err, stdout) {
// Check if a Python executable is the correct version to use.
// Will exit the Python finder on success.
checkExecPath: function checkExecPath (execPath, errorCallback) {
this.log.verbose(`- executing "${execPath}" to get version`)
this.run(execPath, this.argsVersion, false, function (err, version) {
// Possible outcomes:
// - Error: executable can not be run (likely meaning the command wasn't
// a Python executable and the previous command produced gibberish)
// - Gibberish: somehow the last command produced an executable path,
// this will fail when verifying the version
// - Version of the Python executable
if (err) {
return this.callback(err)
this.addLog(`- "${execPath}" could not be run`)
return errorCallback(err)
}
this.log.verbose('check python version',
'`%s -c "' + args[1] + '"` returned: %j',
this.python, stdout)
var version = stdout.trim()
var range = semver.Range('>=2.5.0 <3.0.0')
this.addLog(`- version is "${version}"`)
const range = semver.Range(this.semverRange)
var valid = false
try {
valid = range.test(version)
} catch (e) {
this.log.silly('range.test() error', e)
} catch (err) {
this.log.silly('range.test() threw:\n%s', err.stack)
this.addLog(`- "${execPath}" does not have a valid version`)
this.addLog('- is it a Python executable?')
return errorCallback(err)
}
if (valid) {
this.callback(null, this.python)
} else if (this.win && this.checkPythonLauncherDepth === 0) {
this.checkPythonLauncher()
} else {
this.failPythonVersion(version)
if (!valid) {
this.addLog(`- version is ${version} - should be ${this.semverRange}`)
this.addLog('- THIS VERSION OF PYTHON IS NOT SUPPORTED')
return errorCallback(new Error(
`Found unsupported Python version ${version}`))
}
this.succeed(execPath, version)
}.bind(this))
},
failNoPython: function failNoPython () {
var errmsg =
'Can\'t find Python executable "' + this.python +
'", you can set the PYTHON env variable.'
this.callback(new Error(errmsg))
},
// Run an executable or shell command, trimming the output.
run: function run(exec, args, shell, callback) {
var env = extend({}, this.env)
env.TERM = 'dumb'
const opts = { env: env, shell: shell }
failPythonVersion: function failPythonVersion (badVersion) {
var errmsg =
'Python executable "' + this.python +
'" is v' + badVersion + ', which is not supported by gyp.\n' +
'You can pass the --python switch to point to ' +
'Python >= v2.5.0 & < 3.0.0.'
this.callback(new Error(errmsg))
},
this.log.silly('execFile: exec = %j', exec)
this.log.silly('execFile: args = %j', args)
this.log.silly('execFile: opts = %j', opts)
try {
this.execFile(exec, args, opts, execFileCallback.bind(this))
} catch (err) {
this.log.silly('execFile: threw:\n%s', err.stack)
return callback(err)
}
// Called on Windows when "python" isn't available in the current $PATH.
// We are going to check if "%SystemDrive%\python27\python.exe" exists.
guessPython: function guessPython () {
this.log.verbose('could not find "' + this.python + '". guessing location')
var rootDir = this.env.SystemDrive || 'C:\\'
if (rootDir[rootDir.length - 1] !== '\\') {
rootDir += '\\'
}
var pythonPath = this.resolve(rootDir, 'Python27', 'python.exe')
this.log.verbose('ensuring that file exists:', pythonPath)
this.stat(pythonPath, function (err, stat) {
function execFileCallback(err, stdout, stderr) {
this.log.silly('execFile result: err = %j', err && err.stack || err)
this.log.silly('execFile result: stdout = %j', stdout)
this.log.silly('execFile result: stderr = %j', stderr)
if (err) {
if (err.code == 'ENOENT') {
this.failNoPython()
} else {
this.callback(err)
}
return
return callback(err)
}
this.python = pythonPath
this.checkPythonVersion()
}.bind(this))
const execPath = stdout.trim()
callback(null, execPath)
}
},
succeed: function succeed(execPath, version) {
this.log.info(`using Python version ${version} found at "${execPath}"`)
process.nextTick(this.callback.bind(null, null, execPath))
},
fail: function fail() {
const errorLog = this.errorLog.join('\n')
const pathExample = this.win ? 'C:\\Path\\To\\python.exe' :
'/path/to/pythonexecutable'
// For Windows 80 col console, use up to the column before the one marked
// with X (total 79 chars including logger prefix, 58 chars usable here):
// X
const info = [
'**********************************************************',
'You need to install the latest version of Python 2.7.',
'Node-gyp should be able to find and use Python. If not,',
'you can try one of the following options:',
`- Use the switch --python="${pathExample}"`,
' (accepted by both node-gyp and npm)',
'- Set the environment variable PYTHON',
'- Set the npm configuration variable python:',
` npm config set python "${pathExample}"`,
'For more information consult the documentation at:',
'https://github.com/nodejs/node-gyp#installation',
'**********************************************************',
].join('\n')
this.log.error(`\n${errorLog}\n\n${info}\n`)
process.nextTick(this.callback.bind(null, new Error (
'Could not find any Python 2 installation to use')))
},
}
function findPython (python, callback) {
var finder = new PythonFinder(python, callback)
finder.checkPython()
function findPython (configPython, callback) {
var finder = new PythonFinder(configPython, callback)
finder.findPython()
}
var path = require('path')
, log = require('npmlog')
function findNodeDirectory(scriptLocation, processObj) {
module.exports = function findNodeDirectory(scriptLocation, processObj) {
// set dirname and process if not passed in

@@ -60,3 +60,1 @@ // this facilitates regression tests

}
module.exports = findNodeDirectory

@@ -13,10 +13,5 @@ module.exports = exports = function (gyp, argv, callback) {

/**
* Module dependencies.
*/
var fs = require('graceful-fs')
, osenv = require('osenv')
, os = require('os')
, tar = require('tar')
, rm = require('rimraf')
, path = require('path')

@@ -32,3 +27,2 @@ , crypto = require('crypto')

function install (fs, gyp, argv, callback) {
var release = processRelease(argv, gyp, process.version, process.release)

@@ -43,3 +37,3 @@

// roll-back the install if anything went wrong
gyp.commands.remove([ release.versionDir ], function (err2) {
gyp.commands.remove([ release.versionDir ], function () {
callback(err)

@@ -86,3 +80,3 @@ })

log.verbose('install', '--ensure was passed, so won\'t reinstall if already installed')
fs.stat(devDir, function (err, stat) {
fs.stat(devDir, function (err) {
if (err) {

@@ -131,3 +125,2 @@ if (err.code == 'ENOENT') {

function go () {
log.verbose('ensuring nodedir is created', devDir)

@@ -160,3 +153,3 @@

// only .h header files and the gyp files get extracted
function isValid (path, entry) {
function isValid (path) {
var isValid = valid(path)

@@ -174,3 +167,2 @@ if (isValid) {

// download the tarball and extract!
if (tarPath) {

@@ -282,4 +274,2 @@ return tar.extract({

log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
var shasumsPath = path.resolve(devDir, 'SHASUMS256.txt')
log.verbose('checksum url', release.shasumsUrl)

@@ -421,5 +411,5 @@ try {

if (-1 !== argv.indexOf(noretry)) return cb(err)
var tmpdir = osenv.tmpdir()
var tmpdir = os.tmpdir()
gyp.devDir = path.resolve(tmpdir, '.node-gyp')
log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', osenv.user(), devDir)
log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', os.userInfo().username, devDir)
log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)

@@ -426,0 +416,0 @@ if (process.cwd() == tmpdir) {

@@ -6,16 +6,9 @@

/**
* Module dependencies.
*/
var fs = require('graceful-fs')
, path = require('path')
, log = require('npmlog')
function list (gyp, args, callback) {
var devDir = gyp.devDir
log.verbose('list', 'using node-gyp dir:', devDir)
// readdir() the node-gyp dir
fs.readdir(devDir, onreaddir)

@@ -22,0 +15,0 @@

/**
* Module exports.
*/
module.exports = exports = gyp
/**
* Module dependencies.
*/
var fs = require('graceful-fs')
, path = require('path')
var path = require('path')
, nopt = require('nopt')

@@ -38,6 +29,2 @@ , log = require('npmlog')

/**
* The `gyp` function.
*/
function gyp () {

@@ -217,2 +204,1 @@ return new Gyp()

})

@@ -12,3 +12,3 @@ var semver = require('semver')

// Captures all the logic required to determine download URLs, local directory and
// Captures all the logic required to determine download URLs, local directory and
// file names. Inputs come from command-line switches (--target, --dist-url),

@@ -21,3 +21,2 @@ // `process.version` and `process.release` where it exists.

, isDefaultVersion
, isIojs
, name

@@ -47,33 +46,12 @@ , distBaseUrl

// v3 onward, has process.release
name = defaultRelease.name.replace(/io\.js/, 'iojs') // remove the '.' for directory naming purposes
isIojs = name === 'iojs'
name = defaultRelease.name
} else {
// old node or alternative --target=
// semver.satisfies() doesn't like prerelease tags so test major directly
isIojs = versionSemver.major >= 1 && versionSemver.major < 4
name = isIojs ? 'iojs' : 'node'
name = 'node'
}
// check for the nvm.sh standard mirror env variables
if (!overrideDistUrl) {
if (isIojs) {
if (process.env.IOJS_ORG_MIRROR) {
overrideDistUrl = process.env.IOJS_ORG_MIRROR
} else if (process.env.NVM_IOJS_ORG_MIRROR) {// remove on next semver-major
overrideDistUrl = process.env.NVM_IOJS_ORG_MIRROR
log.warn('download',
'NVM_IOJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, ' +
'please use IOJS_ORG_MIRROR')
}
} else {
if (process.env.NODEJS_ORG_MIRROR) {
overrideDistUrl = process.env.NODEJS_ORG_MIRROR
} else if (process.env.NVM_NODEJS_ORG_MIRROR) {// remove on next semver-major
overrideDistUrl = process.env.NVM_NODEJS_ORG_MIRROR
log.warn('download',
'NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, ' +
'please use NODEJS_ORG_MIRROR')
}
}
}
if (!overrideDistUrl && process.env.NODEJS_ORG_MIRROR)
overrideDistUrl = process.env.NODEJS_ORG_MIRROR

@@ -86,3 +64,3 @@ if (overrideDistUrl)

else
distBaseUrl = isIojs ? 'https://iojs.org/download/release' : 'https://nodejs.org/dist'
distBaseUrl = 'https://nodejs.org/dist'
distBaseUrl += '/v' + version + '/'

@@ -95,31 +73,18 @@

libUrl64 = resolveLibUrl(name, defaultRelease.libUrl || baseUrl || distBaseUrl, 'x64', versionSemver.major)
tarballUrl = defaultRelease.headersUrl
} else {
// older versions without process.release are captured here and we have to make
// a lot of assumptions, additionally if you --target=x.y.z then we can't use the
// current process.release
baseUrl = distBaseUrl
libUrl32 = resolveLibUrl(name, baseUrl, 'x86', versionSemver.major)
libUrl64 = resolveLibUrl(name, baseUrl, 'x64', versionSemver.major)
return {
version: version,
semver: versionSemver,
name: name,
baseUrl: baseUrl,
tarballUrl: defaultRelease.headersUrl,
shasumsUrl: url.resolve(baseUrl, 'SHASUMS256.txt'),
versionDir: (name !== 'node' ? name + '-' : '') + version,
libUrl32: libUrl32,
libUrl64: libUrl64,
libPath32: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl32).path)),
libPath64: normalizePath(path.relative(url.parse(baseUrl).path, url.parse(libUrl64).path))
}
// making the bold assumption that anything with a version number >3.0.0 will
// have a *-headers.tar.gz file in its dist location, even some frankenstein
// custom version
canGetHeaders = semver.satisfies(versionSemver, headersTarballRange)
tarballUrl = url.resolve(baseUrl, name + '-v' + version + (canGetHeaders ? '-headers' : '') + '.tar.gz')
}
// older versions without process.release are captured here and we have to make
// a lot of assumptions, additionally if you --target=x.y.z then we can't use the
// current process.release
baseUrl = distBaseUrl
libUrl32 = resolveLibUrl(name, baseUrl, 'x86', versionSemver.major)
libUrl64 = resolveLibUrl(name, baseUrl, 'x64', versionSemver.major)
// making the bold assumption that anything with a version number >3.0.0 will
// have a *-headers.tar.gz file in its dist location, even some frankenstein
// custom version
canGetHeaders = semver.satisfies(versionSemver, headersTarballRange)
tarballUrl = url.resolve(baseUrl, name + '-v' + version + (canGetHeaders ? '-headers' : '') + '.tar.gz')
return {

@@ -126,0 +91,0 @@ version: version,

@@ -7,3 +7,2 @@

function rebuild (gyp, argv, callback) {
gyp.todo.push(

@@ -10,0 +9,0 @@ { name: 'clean', args: [] }

@@ -6,6 +6,2 @@

/**
* Module dependencies.
*/
var fs = require('fs')

@@ -18,3 +14,2 @@ , rm = require('rimraf')

function remove (gyp, argv, callback) {
var devDir = gyp.devDir

@@ -41,3 +36,3 @@ log.verbose('remove', 'using node-gyp dir:', devDir)

// first check if its even installed
fs.stat(versionPath, function (err, stat) {
fs.stat(versionPath, function (err) {
if (err) {

@@ -54,3 +49,2 @@ if (err.code == 'ENOENT') {

})
}

@@ -14,3 +14,3 @@ {

],
"version": "4.0.0",
"version": "5.0.0",
"installVersion": 9,

@@ -26,2 +26,3 @@ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)",

"dependencies": {
"env-paths": "^1.0.0",
"glob": "^7.0.3",

@@ -32,3 +33,2 @@ "graceful-fs": "^4.1.2",

"npmlog": "0 || 1 || 2 || 3 || 4",
"osenv": "0",
"request": "^2.87.0",

@@ -41,13 +41,16 @@ "rimraf": "2",

"engines": {
"node": ">= 4.0.0"
"node": ">= 6.0.0"
},
"devDependencies": {
"tape": "~4.2.0",
"babel-eslint": "^8.2.5",
"bindings": "~1.2.1",
"eslint": "^5.0.1",
"nan": "^2.0.0",
"require-inject": "~1.3.0"
"require-inject": "~1.3.0",
"tape": "~4.2.0"
},
"scripts": {
"test": "tape test/test-*"
"lint": "eslint bin lib test",
"test": "npm run lint && tape test/test-*"
}
}

@@ -1,15 +0,10 @@

node-gyp
=========
## Node.js native addon build tool
# `node-gyp` - Node.js native addon build tool
`node-gyp` is a cross-platform command-line tool written in Node.js for compiling
native addon modules for Node.js. It bundles the [gyp](https://gyp.gsrc.io)
native addon modules for Node.js. It bundles the [gyp](https://gyp.gsrc.io)
project used by the Chromium team and takes away the pain of dealing with the
various differences in build platforms. It is the replacement to the `node-waf`
program which is removed for node `v0.8`. If you have a native addon for node that
still has a `wscript` file, then you should definitely add a `binding.gyp` file
to support the latest versions of node.
various differences in build platforms.
Multiple target versions of node are supported (i.e. `0.8`, ..., `4`, `5`, `6`,
etc.), regardless of what version of node is actually installed on your system
Multiple target versions of Node.js are supported (i.e. `0.8`, ..., `4`, `5`, `6`,
etc.), regardless of what version of Node.js is actually installed on your system
(`node-gyp` downloads the necessary development files or headers for the target version).

@@ -21,8 +16,6 @@

* Same commands to build your module on every platform
* Supports multiple target versions of Node
* Supports multiple target versions of Node.js
## Installation
Installation
------------
You can install with `npm`:

@@ -66,4 +59,8 @@

To target native ARM64 Node.js on Windows 10 on ARM, add the components "Visual C++ compilers and libraries for ARM64" and "Visual C++ ATL for ARM64".
### Configuring Python Dependency
If you have multiple Python versions installed, you can identify which Python
version `node-gyp` uses by setting the '--python' variable:
version `node-gyp` uses by setting the `--python` variable:

@@ -74,3 +71,3 @@ ``` bash

If `node-gyp` is called by way of `npm` *and* you have multiple versions of
If `node-gyp` is called by way of `npm`, *and* you have multiple versions of
Python installed, then you can set `npm`'s 'python' config key to the appropriate

@@ -83,4 +80,3 @@ value:

How to Use
----------
## How to Use

@@ -106,7 +102,7 @@ To compile your native addon, first go to its root directory:

__Note__: The `configure` step looks for the `binding.gyp` file in the current
directory to process. See below for instructions on creating the `binding.gyp` file.
__Note__: The `configure` step looks for a `binding.gyp` file in the current
directory to process. See below for instructions on creating a `binding.gyp` file.
Now you will have either a `Makefile` (on Unix platforms) or a `vcxproj` file
(on Windows) in the `build/` directory. Next invoke the `build` command:
(on Windows) in the `build/` directory. Next, invoke the `build` command:

@@ -118,19 +114,16 @@ ``` bash

Now you have your compiled `.node` bindings file! The compiled bindings end up
in `build/Debug/` or `build/Release/`, depending on the build mode. At this point
you can require the `.node` file with Node and run your tests!
in `build/Debug/` or `build/Release/`, depending on the build mode. At this point,
you can require the `.node` file with Node.js and run your tests!
__Note:__ To create a _Debug_ build of the bindings file, pass the `--debug` (or
`-d`) switch when running either the `configure`, `build` or `rebuild` command.
`-d`) switch when running either the `configure`, `build` or `rebuild` commands.
## The `binding.gyp` file
The "binding.gyp" file
----------------------
A `binding.gyp` file describes the configuration to build your module, in a
JSON-like format. This file gets placed in the root of your package, alongside
`package.json`.
Previously when node had `node-waf` you had to write a `wscript` file. The
replacement for that is the `binding.gyp` file, which describes the configuration
to build your module in a JSON-like format. This file gets placed in the root of
your package, alongside the `package.json` file.
A barebones `gyp` file appropriate for building a Node.js addon could look like:
A barebones `gyp` file appropriate for building a node addon looks like:
``` python

@@ -156,4 +149,3 @@ {

Commands
--------
## Commands

@@ -169,9 +161,8 @@ `node-gyp` responds to the following commands:

| `rebuild` | Runs `clean`, `configure` and `build` all in a row
| `install` | Installs node header files for the given version
| `list` | Lists the currently installed node header versions
| `remove` | Removes the node header files for the given version
| `install` | Installs Node.js header files for the given version
| `list` | Lists the currently installed Node.js header versions
| `remove` | Removes the Node.js header files for the given version
Command Options
--------
## Command Options

@@ -182,15 +173,15 @@ `node-gyp` accepts the following command options:

|:----------------------------------|:------------------------------------------
| `-j n`, `--jobs n` | Run make in parallel
| `--target=v6.2.1` | Node version to build for (default=process.version)
| `-j n`, `--jobs n` | Run `make` in parallel
| `--target=v6.2.1` | Node.js version to build for (default is `process.version`)
| `--silly`, `--loglevel=silly` | Log all progress to console
| `--verbose`, `--loglevel=verbose` | Log most progress to console
| `--silent`, `--loglevel=silent` | Don't log anything to console
| `debug`, `--debug` | Make Debug build (default=Release)
| `debug`, `--debug` | Make Debug build (default is `Release`)
| `--release`, `--no-debug` | Make Release build
| `-C $dir`, `--directory=$dir` | Run command in different directory
| `--make=$make` | Override make command (e.g. gmake)
| `--make=$make` | Override `make` command (e.g. `gmake`)
| `--thin=yes` | Enable thin static libraries
| `--arch=$arch` | Set target architecture (e.g. ia32)
| `--tarball=$path` | Get headers from a local tarball
| `--devdir=$path` | SDK download directory (default=~/.node-gyp)
| `--devdir=$path` | SDK download directory (default is OS cache directory)
| `--ensure` | Don't reinstall headers if already present

@@ -201,54 +192,43 @@ | `--dist-url=$url` | Download header tarball from custom URL

| `--nodedir=$path` | Set the path to the node source code
| `--python=$path` | Set path to the python (2) binary
| `--msvs_version=$version` | Set Visual Studio version (win)
| `--solution=$solution` | Set Visual Studio Solution version (win)
| `--python=$path` | Set path to the Python 2 binary
| `--msvs_version=$version` | Set Visual Studio version (Windows only)
| `--solution=$solution` | Set Visual Studio Solution version (Windows only)
## Configuration
Configuration
--------
### Environment variables
__`node-gyp` responds to environment variables or `npm` configuration__
1. Environment variables take the form `npm_config_OPTION_NAME` for any of the
options listed above (dashes in option names should be replaced by underscores).
These work also when `node-gyp` is invoked directly:
`$ export npm_config_devdir=/tmp/.gyp`
or on Windows
`> set npm_config_devdir=c:\temp\.gyp`
2. As `npm` configuration, variables take the form `OPTION_NAME`.
This way only works when `node-gyp` is executed by `npm`:
`$ npm config set [--global] devdir /tmp/.gyp`
`$ npm i buffertools`
Use the form `npm_config_OPTION_NAME` for any of the command options listed
above (dashes in option names should be replaced by underscores).
For example, to set `devdir` equal to `/tmp/.gyp`, you would:
License
-------
Run this on Unix:
(The MIT License)
```bash
$ export npm_config_devdir=/tmp/.gyp
```
Copyright (c) 2012 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
Or this on Windows:
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
```console
> set npm_config_devdir=c:\temp\.gyp
```
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
### `npm` configuration
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Use the form `OPTION_NAME` for any of the command options listed above.
For example, to set `devdir` equal to `/tmp/.gyp`, you would run:
[python-v2.7.10]: https://www.python.org/downloads/release/python-2710/
[msvc2013]: https://www.microsoft.com/en-gb/download/details.aspx?id=44914
[win7sdk]: https://www.microsoft.com/en-us/download/details.aspx?id=8279
[compiler update for the Windows SDK 7.1]: https://www.microsoft.com/en-us/download/details.aspx?id=4422
```bash
$ npm config set [--global] devdir /tmp/.gyp
```
**Note:** Configuration set via `npm` will only be used when `node-gyp`
is run via `npm`, not when `node-gyp` is run directly.
## License
`node-gyp` is available under the MIT license. See the [LICENSE
file](LICENSE) for details.

@@ -13,3 +13,3 @@ 'use strict'

function processExecSync(file, args, options) {
var child, error, timeout, tmpdir, command, quote
var child, error, timeout, tmpdir, command
command = makeCommand(file, args)

@@ -16,0 +16,0 @@

@@ -7,2 +7,3 @@ 'use strict'

var child_process = require('child_process')
var os = require('os')
var addonPath = path.resolve(__dirname, 'node_modules', 'hello_world')

@@ -13,5 +14,9 @@ var nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js')

function runHello() {
function runHello(hostProcess) {
if (!hostProcess) {
hostProcess = process.execPath
}
var testCode = "console.log(require('hello_world').hello())"
return execFileSync(process.execPath, ['-e', testCode], { cwd: __dirname }).toString()
console.log('running ', hostProcess);
return execFileSync(hostProcess, ['-e', testCode], { cwd: __dirname }).toString()
}

@@ -116,1 +121,27 @@

})
test('addon works with renamed host executable', function (t) {
// No `fs.copyFileSync` before node8.
if (process.version.substr(1).split('.')[0] < 8) {
t.skip("skipping test for old node version");
t.end();
return;
}
t.plan(3)
var notNodePath = path.join(os.tmpdir(), 'notnode' + path.extname(process.execPath))
fs.copyFileSync(process.execPath, notNodePath)
var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose']
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) {
var logLines = stderr.toString().trim().split(/\r?\n/)
var lastLine = logLines[logLines.length-1]
t.strictEqual(err, null)
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok')
t.strictEqual(runHello(notNodePath).trim(), 'world')
fs.unlinkSync(notNodePath)
})
proc.stdout.setEncoding('utf-8')
proc.stderr.setEncoding('utf-8')
})

@@ -9,4 +9,4 @@ 'use strict'

'graceful-fs': {
'openSync': function (file, mode) { return 0; },
'closeSync': function (fd) { },
'openSync': function () { return 0; },
'closeSync': function () { },
'writeFile': function (file, data, cb) { cb() },

@@ -13,0 +13,0 @@ 'stat': function (file, cb) { cb(null, {}) }

@@ -8,3 +8,3 @@ 'use strict'

'graceful-fs': {
'closeSync': function (fd) { return undefined },
'closeSync': function () { return undefined },
'openSync': function (path) {

@@ -11,0 +11,0 @@ if (readableFiles.some(function (f) { return f === path} )) {

'use strict'
var test = require('tape')
var path = require('path')
var configure = require('../lib/configure')

@@ -12,3 +11,3 @@ var execFile = require('child_process').execFile

configure.test.findPython('python', function (err, found) {
configure.test.findPython(null, function (err, found) {
t.strictEqual(err, null)

@@ -27,10 +26,10 @@ var proc = execFile(found, ['-V'], function (err, stdout, stderr) {

function fail() {
throw new Error('Property ' + property + ' should not have been accessed.')
console.error(Error(`Property ${property} should not have been accessed.`))
process.abort()
}
var descriptor = {
configurable: true,
configurable: false,
enumerable: false,
writable: true,
getter: fail,
setter: fail,
get: fail,
set: fail,
}

@@ -40,37 +39,34 @@ Object.defineProperty(object, property, descriptor)

// Work around a v0.10.x CI issue where path.resolve() on UNIX systems prefixes
// Windows paths with the current working directory. v0.12 and up are free of
// this issue because they use path.win32.resolve() which does the right thing.
var resolve = path.win32 && path.win32.resolve || function() {
function rstrip(s) { return s.replace(/\\+$/, '') }
return [].slice.call(arguments).map(rstrip).join('\\')
}
function TestPythonFinder() { PythonFinder.apply(this, arguments) }
TestPythonFinder.prototype = Object.create(PythonFinder.prototype)
poison(TestPythonFinder.prototype, 'env')
poison(TestPythonFinder.prototype, 'execFile')
poison(TestPythonFinder.prototype, 'resolve')
poison(TestPythonFinder.prototype, 'stat')
poison(TestPythonFinder.prototype, 'which')
poison(TestPythonFinder.prototype, 'win')
// Silence npmlog - remove for debugging
TestPythonFinder.prototype.log = {
silly: () => {},
verbose: () => {},
info: () => {},
warn: () => {},
error: () => {},
}
test('find python - python', function (t) {
t.plan(5)
t.plan(6)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
f.execFile = function(program, args, opts, cb) {
poison(f, 'execFile')
t.strictEqual(program, '/path/python')
t.ok(/sys\.version_info/.test(args[1]))
cb(null, '2.7.15')
}
t.strictEqual(program,
process.platform === 'win32' ? '"python"' : 'python')
t.ok(/sys\.executable/.test(args[1]))
cb(null, '/path/python')
}
f.checkPython()
f.findPython()
function done(err, python) {
t.strictEqual(err, null)
t.strictEqual(python, 'python')
t.strictEqual(python, '/path/python')
}

@@ -80,18 +76,19 @@ })

test('find python - python too old', function (t) {
t.plan(4)
t.plan(2)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
var f = new TestPythonFinder(null, done)
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '2.3.4')
if (/sys\.executable/.test(args[args.length-1])) {
cb(null, '/path/python')
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(null, '2.3.4')
} else {
t.fail()
}
}
f.checkPython()
f.findPython()
function done(err, python) {
t.ok(/is not supported by gyp/.test(err))
function done(err) {
t.ok(/Could not find any Python/.test(err))
t.ok(/not supported/i.test(f.errorLog))
}

@@ -101,18 +98,19 @@ })

test('find python - python too new', function (t) {
t.plan(4)
t.plan(2)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
var f = new TestPythonFinder(null, done)
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '3.0.0')
if (/sys\.executable/.test(args[args.length-1])) {
cb(null, '/path/python')
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(null, '3.0.0')
} else {
t.fail()
}
}
f.checkPython()
f.findPython()
function done(err, python) {
t.ok(/is not supported by gyp/.test(err))
function done(err) {
t.ok(/Could not find any Python/.test(err))
t.ok(/not supported/i.test(f.errorLog))
}

@@ -124,11 +122,17 @@ })

var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
var f = new TestPythonFinder(null, done)
f.execFile = function(program, args, opts, cb) {
if (/sys\.executable/.test(args[args.length-1])) {
cb(new Error('not found'))
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(new Error('not a Python executable'))
} else {
t.fail()
}
}
f.checkPython()
f.findPython()
function done(err, python) {
t.ok(/Can't find Python executable/.test(err))
function done(err) {
t.ok(/Could not find any Python/.test(err))
t.ok(/not in PATH/.test(f.errorLog))
}

@@ -138,23 +142,23 @@ })

test('find python - no python2', function (t) {
t.plan(6)
t.plan(2)
var f = new TestPythonFinder('python2', done)
f.which = function(program, cb) {
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
var f = new TestPythonFinder(null, done)
f.execFile = function(program, args, opts, cb) {
if (/sys\.executable/.test(args[args.length-1])) {
if (program == 'python2') {
cb(new Error('not found'))
} else {
cb(null, '/path/python')
}
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(null, '2.7.14')
} else {
t.fail()
}
t.strictEqual(program, 'python2')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
}
f.checkPython()
f.findPython()
function done(err, python) {
t.strictEqual(err, null)
t.strictEqual(python, 'python')
t.strictEqual(python, '/path/python')
}

@@ -164,20 +168,20 @@ })

test('find python - no python2, no python, unix', function (t) {
t.plan(3)
t.plan(2)
var f = new TestPythonFinder('python2', done)
poison(f, 'checkPythonLauncher')
var f = new TestPythonFinder(null, done)
f.checkPyLauncher = t.fail
f.win = false
f.which = function(program, cb) {
f.which = function(program, cb) {
t.strictEqual(program, 'python')
f.execFile = function(program, args, opts, cb) {
if (/sys\.executable/.test(args[args.length-1])) {
cb(new Error('not found'))
} else {
t.fail()
}
t.strictEqual(program, 'python2')
cb(new Error('not found'))
}
f.checkPython()
f.findPython()
function done(err, python) {
t.ok(/Can't find Python executable/.test(err))
function done(err) {
t.ok(/Could not find any Python/.test(err))
t.ok(/not in PATH/.test(f.errorLog))
}

@@ -187,24 +191,26 @@ })

test('find python - no python, use python launcher', function (t) {
t.plan(8)
t.plan(4)
var f = new TestPythonFinder('python', done)
f.env = {}
var f = new TestPythonFinder(null, done)
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'Z:\\snake.exe')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
if (program === 'py.exe') {
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
return cb(null, 'Z:\\snake.exe')
}
t.strictEqual(program, 'py.exe')
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
cb(null, 'Z:\\snake.exe')
if (/sys\.executable/.test(args[args.length-1])) {
cb(new Error('not found'))
} else if (/sys\.version_info/.test(args[args.length-1])) {
if (program === 'Z:\\snake.exe') {
cb(null, '2.7.14')
} else {
t.fail()
}
} else {
t.fail()
}
}
f.checkPython()
f.findPython()

@@ -218,29 +224,30 @@ function done(err, python) {

test('find python - python 3, use python launcher', function (t) {
t.plan(10)
t.plan(4)
var f = new TestPythonFinder('python', done)
f.env = {}
var f = new TestPythonFinder(null, done)
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
if (program === 'py.exe') {
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'Z:\\snake.exe')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
poison(f, 'execFile')
if (/sys\.version_info/.test(args[args.length-1])) {
cb(null, '2.7.14')
} else {
t.fail()
}
}
t.strictEqual(program, 'py.exe')
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
cb(null, 'Z:\\snake.exe')
return cb(null, 'Z:\\snake.exe')
}
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '3.0.0')
if (/sys\.executable/.test(args[args.length-1])) {
cb(null, '/path/python')
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(null, '3.0.0')
} else {
t.fail()
}
}
f.checkPython()
f.findPython()

@@ -255,33 +262,43 @@ function done(err, python) {

function (t) {
t.plan(9)
t.plan(6)
var f = new TestPythonFinder('python', done)
f.checkedPythonLauncher = false
f.env = {}
var f = new TestPythonFinder(null, done)
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
if (program === 'py.exe') {
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'Z:\\snake.exe')
t.ok(/import sys/.test(args[1]))
cb(null, '2.3.4')
if (/sys\.version_info/.test(args[args.length-1])) {
f.execFile = function(program, args, opts, cb) {
if (/sys\.version_info/.test(args[args.length-1])) {
poison(f, 'execFile')
t.strictEqual(program, f.defaultLocation)
cb(new Error('not found'))
} else {
t.fail()
}
}
t.strictEqual(program, 'Z:\\snake.exe')
cb(null, '2.3.4')
} else {
t.fail()
}
}
t.strictEqual(program, 'py.exe')
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
cb(null, 'Z:\\snake.exe')
return cb(null, 'Z:\\snake.exe')
}
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '3.0.0')
if (/sys\.executable/.test(args[args.length-1])) {
cb(null, '/path/python')
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(null, '3.0.0')
} else {
t.fail()
}
}
f.checkPython()
f.findPython()
function done(err, python) {
t.ok(/is not supported by gyp/.test(err))
function done(err) {
t.ok(/Could not find any Python/.test(err))
t.ok(/not supported/i.test(f.errorLog))
}

@@ -291,30 +308,28 @@ })

test('find python - no python, no python launcher, good guess', function (t) {
t.plan(6)
t.plan(4)
var re = /C:[\\\/]Python27[\\\/]python[.]exe/
var f = new TestPythonFinder('python', done)
f.env = {}
var f = new TestPythonFinder(null, done)
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
t.ok(re.test(program))
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
if (program === 'py.exe') {
f.execFile = function(program, args, opts, cb) {
poison(f, 'execFile')
t.ok(re.test(program))
t.ok(/sys\.version_info/.test(args[args.length-1]))
cb(null, '2.7.14')
}
return cb(new Error('not found'))
}
t.strictEqual(program, 'py.exe')
cb(new Error('not found'))
if (/sys\.executable/.test(args[args.length-1])) {
cb(new Error('not found'))
} else {
t.fail()
}
}
f.resolve = resolve
f.stat = function(path, cb) {
t.ok(re.test(path))
cb(null, {})
}
f.checkPython()
f.findPython()
function done(err, python) {
t.strictEqual(err, null)
t.ok(re.test(python))

@@ -325,28 +340,22 @@ }

test('find python - no python, no python launcher, bad guess', function (t) {
t.plan(4)
t.plan(2)
var f = new TestPythonFinder('python', done)
f.env = { SystemDrive: 'Z:\\' }
var f = new TestPythonFinder(null, done)
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'py.exe')
cb(new Error('not found'))
if (/sys\.executable/.test(args[args.length-1])) {
cb(new Error('not found'))
} else if (/sys\.version_info/.test(args[args.length-1])) {
cb(new Error('not a Python executable'))
} else {
t.fail()
}
}
f.resolve = resolve
f.stat = function(path, cb) {
t.ok(/Z:[\\\/]Python27[\\\/]python.exe/.test(path))
var err = new Error('not found')
err.code = 'ENOENT'
cb(err)
}
f.checkPython()
f.findPython()
function done(err, python) {
t.ok(/Can't find Python executable/.test(err))
function done(err) {
t.ok(/Could not find any Python/.test(err))
t.ok(/not in PATH/.test(f.errorLog))
}
})

@@ -190,127 +190,2 @@ var test = require('tape')

test('test process release - process.version = 1.8.4', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v1.8.4', null)
t.equal(release.semver.version, '1.8.4')
delete release.semver
t.deepEqual(release, {
version: '1.8.4',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v1.8.4/',
tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
versionDir: 'iojs-1.8.4',
libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.2.24', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})
t.equal(release.semver.version, '3.2.24')
delete release.semver
t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.24/',
tarballUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'https://iojs.org/download/release/v3.2.24/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.2.11 +libUrl32', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.11', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.11')
delete release.semver
t.deepEqual(release, {
version: '3.2.11',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.11/',
tarballUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.11/SHASUMS256.txt',
versionDir: 'iojs-3.2.11',
libUrl32: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.11/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.2.101 +libUrl64', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.101', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.101')
delete release.semver
t.deepEqual(release, {
version: '3.2.101',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.101/',
tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.3.0 - borked win-ia32', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.101', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.101/win-ia32/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.101')
delete release.semver
t.deepEqual(release, {
version: '3.2.101',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.101/',
tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --target=0.10.40', function (t) {

@@ -341,27 +216,2 @@ t.plan(2)

test('test process release - process.release ~ node@4.1.23 --target=1.8.4', function (t) {
t.plan(2)
var release = processRelease([], { opts: { target: '1.8.4' } }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '1.8.4')
delete release.semver
t.deepEqual(release, {
version: '1.8.4',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v1.8.4/',
tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
versionDir: 'iojs-1.8.4',
libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --dist-url=https://foo.bar/baz', function (t) {

@@ -552,89 +402,1 @@ t.plan(2)

})
test('test process release - NVM_NODEJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.NVM_NODEJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'http://foo.bar/v4.1.23/',
tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'http://foo.bar/v4.1.23/win-x86/node.lib',
libUrl64: 'http://foo.bar/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
delete process.env.NVM_NODEJS_ORG_MIRROR
})
test('test process release - IOJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.IOJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})
t.equal(release.semver.version, '3.2.24')
delete release.semver
t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'http://foo.bar/v3.2.24/',
tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
delete process.env.IOJS_ORG_MIRROR
})
test('test process release - NVM_IOJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.NVM_IOJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})
t.equal(release.semver.version, '3.2.24')
delete release.semver
t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'http://foo.bar/v3.2.24/',
tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
delete process.env.NVM_IOJS_ORG_MIRROR
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc