node-gyp
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -15,2 +15,4 @@ #!/usr/bin/env node | ||
var log = require('npmlog') | ||
var osenv = require('osenv') | ||
var path = require('path') | ||
@@ -24,3 +26,16 @@ /** | ||
prog.parseArgv(process.argv) | ||
prog.devDir = prog.opts.devdir | ||
var homeDir = osenv.home() | ||
if (prog.devDir) { | ||
prog.devDir = prog.devDir.replace(/^~/, homeDir) | ||
} else if (homeDir) { | ||
prog.devDir = path.resolve(homeDir, '.node-gyp') | ||
} else { | ||
throw new Error( | ||
"node-gyp requires that the user's home directory is specified " + | ||
"in either of the environmental variables HOME or USERPROFILE. " + | ||
"Overide with: --devdir /path/to/.node-gyp") | ||
} | ||
if (prog.todo.length === 0) { | ||
@@ -27,0 +42,0 @@ if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { |
@@ -0,2 +1,18 @@ | ||
v3.5.0 2017-01-10 | ||
================= | ||
* [[`762d19a39e`](https://github.com/nodejs/node-gyp/commit/762d19a39e)] - \[doc\] merge History.md and CHANGELOG.md (Rod Vagg) | ||
* [[`80fc5c3d31`](https://github.com/nodejs/node-gyp/commit/80fc5c3d31)] - Fix deprecated dependency warning (Simone Primarosa) [#1069](https://github.com/nodejs/node-gyp/pull/1069) | ||
* [[`05c44944fd`](https://github.com/nodejs/node-gyp/commit/05c44944fd)] - Open the build file with universal-newlines mode (Guy Margalit) [#1053](https://github.com/nodejs/node-gyp/pull/1053) | ||
* [[`37ae7be114`](https://github.com/nodejs/node-gyp/commit/37ae7be114)] - Try python launcher when stock python is python 3. (Ben Noordhuis) [#992](https://github.com/nodejs/node-gyp/pull/992) | ||
* [[`e3778d9907`](https://github.com/nodejs/node-gyp/commit/e3778d9907)] - Add lots of findPython() tests. (Ben Noordhuis) [#992](https://github.com/nodejs/node-gyp/pull/992) | ||
* [[`afc766adf6`](https://github.com/nodejs/node-gyp/commit/afc766adf6)] - Unset executable bit for .bat files (Pavel Medvedev) [#969](https://github.com/nodejs/node-gyp/pull/969) | ||
* [[`ddac348991`](https://github.com/nodejs/node-gyp/commit/ddac348991)] - Use push on PYTHONPATH and add tests (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990) | ||
* [[`b182a19042`](https://github.com/nodejs/node-gyp/commit/b182a19042)] - ***Revert*** "add "path-array" dep" (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990) | ||
* [[`7c08b85c5a`](https://github.com/nodejs/node-gyp/commit/7c08b85c5a)] - ***Revert*** "**configure**: use "path-array" for PYTHONPATH" (Michael Hart) [#990](https://github.com/nodejs/node-gyp/pull/990) | ||
* [[`9c8d275526`](https://github.com/nodejs/node-gyp/commit/9c8d275526)] - Add --devdir flag. (Ben Noordhuis) [#916](https://github.com/nodejs/node-gyp/pull/916) | ||
* [[`f6eab1f9e4`](https://github.com/nodejs/node-gyp/commit/f6eab1f9e4)] - **doc**: add windows-build-tools to readme (Felix Rieseberg) [#970](https://github.com/nodejs/node-gyp/pull/970) | ||
v3.4.0 2016-06-28 | ||
================= | ||
@@ -22,2 +38,3 @@ * [[`ce5fd04e94`](https://github.com/nodejs/node-gyp/commit/ce5fd04e94)] - **deps**: update minimatch version (delphiactual) [#961](https://github.com/nodejs/node-gyp/pull/961) | ||
v3.3.1 2016-03-04 | ||
================= | ||
@@ -27,2 +44,3 @@ * [[`a981ef847a`](https://github.com/nodejs/node-gyp/commit/a981ef847a)] - **gyp**: fix android generator (Robert Chiras) [#889](https://github.com/nodejs/node-gyp/pull/889) | ||
v3.3.0 2016-02-16 | ||
================= | ||
@@ -37,2 +55,3 @@ * [[`818d854a4d`](https://github.com/nodejs/node-gyp/commit/818d854a4d)] - Introduce NODEJS_ORG_MIRROR and IOJS_ORG_MIRROR (Rod Vagg) [#878](https://github.com/nodejs/node-gyp/pull/878) | ||
v3.2.1 2015-12-03 | ||
================= | ||
@@ -43,2 +62,3 @@ * [[`ab89b477c4`](https://github.com/nodejs/node-gyp/commit/ab89b477c4)] - Upgrade gyp to b3cef02. (Ben Noordhuis) [#831](https://github.com/nodejs/node-gyp/pull/831) | ||
v3.2.0 2015-11-25 | ||
================= | ||
@@ -53,2 +73,3 @@ * [[`268f1ca4c7`](https://github.com/nodejs/node-gyp/commit/268f1ca4c7)] - Use result of `which` when searching for python. (Refael Ackermann) [#668](https://github.com/nodejs/node-gyp/pull/668) | ||
v3.1.0 2015-11-14 | ||
================= | ||
@@ -64,2 +85,3 @@ * [[`9049241f91`](https://github.com/nodejs/node-gyp/commit/9049241f91)] - **gyp**: don't use links at all, just copy the files instead (Nathan Zadoks) | ||
v3.0.3 2015-09-14 | ||
================= | ||
@@ -69,2 +91,3 @@ * [[`ad827cda30`](https://github.com/nodejs/node-gyp/commit/ad827cda30)] - tarballUrl global and && when checking for iojs (Lars-Magnus Skog) [#729](https://github.com/nodejs/node-gyp/pull/729) | ||
v3.0.2 2015-09-12 | ||
================= | ||
@@ -75,2 +98,3 @@ * [[`6e8c3bf3c6`](https://github.com/nodejs/node-gyp/commit/6e8c3bf3c6)] - add back support for passing additional cmdline args (Rod Vagg) [#723](https://github.com/nodejs/node-gyp/pull/723) | ||
v3.0.1 2015-09-08 | ||
================= | ||
@@ -80,2 +104,3 @@ * [[`846337e36b`](https://github.com/nodejs/node-gyp/commit/846337e36b)] - normalise versions for target == this comparison (Rod Vagg) [#716](https://github.com/nodejs/node-gyp/pull/716) | ||
v3.0.0 2015-09-08 | ||
================= | ||
@@ -91,1 +116,42 @@ * [[`9720d0373c`](https://github.com/nodejs/node-gyp/commit/9720d0373c)] - remove node_modules from tree (Rod Vagg) [#711](https://github.com/nodejs/node-gyp/pull/711) | ||
* [[`0c720d234c`](https://github.com/nodejs/node-gyp/commit/0c720d234c)] - allow semver@5 (Forrest L Norvell) | ||
2.0.2 / 2015-07-14 | ||
================== | ||
* Use HTTPS for dist url (#656, @SonicHedgehog) | ||
* Merge pull request #648 from nevosegal/master | ||
* Merge pull request #650 from magic890/patch-1 | ||
* Updated Installation section on README | ||
* Updated link to gyp user documentation | ||
* Fix download error message spelling (#643, @tomxtobin) | ||
* Merge pull request #637 from lygstate/master | ||
* Set NODE_GYP_DIR for addon.gypi to setting absolute path for | ||
src/win_delay_load_hook.c, and fixes of the long relative path issue on Win32. | ||
Fixes #636 (#637, @lygstate). | ||
2.0.1 / 2015-05-28 | ||
================== | ||
* configure: try/catch the semver range.test() call | ||
* README: update for visual studio 2013 (#510, @samccone) | ||
2.0.0 / 2015-05-24 | ||
================== | ||
* configure: check for python2 executable by default, fallback to python | ||
* configure: don't clobber existing $PYTHONPATH | ||
* configure: use "path-array" for PYTHONPATH | ||
* gyp: fix for non-acsii userprofile name on Windows | ||
* gyp: always install into $PRODUCT_DIR | ||
* gyp: apply https://codereview.chromium.org/11361103/ | ||
* gyp: don't use links at all, just copy the files instead | ||
* gyp: update gyp to e1c8fcf7 | ||
* Updated README.md with updated Windows build info | ||
* Show URL when a download fails | ||
* package: add a "license" field | ||
* move HMODULE m declaration to top | ||
* Only add "-undefined dynamic_lookup" to loadable_module targets | ||
* win: optionally allow node.exe/iojs.exe to be renamed | ||
* Avoid downloading shasums if using tarPath | ||
* Add target name preprocessor define: `NODE_GYP_MODULE_NAME` | ||
* Show better error message in case of bad network settings |
module.exports = exports = configure | ||
module.exports.test = { findAccessibleSync: findAccessibleSync, | ||
findPython: findPython } | ||
module.exports.test = { | ||
PythonFinder: PythonFinder, | ||
findAccessibleSync: findAccessibleSync, | ||
findPython: findPython, | ||
} | ||
@@ -17,7 +20,4 @@ /** | ||
, cp = require('child_process') | ||
, PathArray = require('path-array') | ||
, extend = require('util')._extend | ||
, processRelease = require('./process-release') | ||
, spawn = cp.spawn | ||
, execFile = cp.execFile | ||
, win = process.platform == 'win32' | ||
@@ -292,4 +292,7 @@ , findNodeDirectory = require('./find-node-directory') | ||
// make sure python uses files that came with this particular node package | ||
var pypath = new PathArray(process.env, 'PYTHONPATH') | ||
pypath.unshift(path.join(__dirname, '..', 'gyp', 'pylib')) | ||
var pypath = [path.join(__dirname, '..', 'gyp', 'pylib')] | ||
if (process.env.PYTHONPATH) { | ||
pypath.push(process.env.PYTHONPATH) | ||
} | ||
process.env.PYTHONPATH = pypath.join(win ? ';' : ':') | ||
@@ -339,30 +342,42 @@ var cp = gyp.spawn(python, argv) | ||
function findPython (python, callback) { | ||
checkPython() | ||
function PythonFinder(python, callback) { | ||
this.callback = callback | ||
this.python = python | ||
} | ||
// Check if Python is in the $PATH | ||
function checkPython () { | ||
log.verbose('check python', 'checking for Python executable "%s" in the PATH', python) | ||
which(python, function (err, execPath) { | ||
PythonFinder.prototype = { | ||
checkPythonLauncherDepth: 0, | ||
env: process.env, | ||
execFile: cp.execFile, | ||
log: log, | ||
stat: fs.stat, | ||
which: which, | ||
win: win, | ||
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) { | ||
if (err) { | ||
log.verbose('`which` failed', python, err) | ||
if (python === 'python2') { | ||
python = 'python' | ||
return checkPython() | ||
this.log.verbose('`which` failed', this.python, err) | ||
if (this.python === 'python2') { | ||
this.python = 'python' | ||
return this.checkPython() | ||
} | ||
if (win) { | ||
checkPythonLauncher() | ||
if (this.win) { | ||
this.checkPythonLauncher() | ||
} else { | ||
failNoPython() | ||
this.failNoPython() | ||
} | ||
} else { | ||
log.verbose('`which` succeeded', python, execPath) | ||
// Found the `python` exceutable, and from now on we use it explicitly. | ||
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)) | ||
python = execPath | ||
checkPythonVersion() | ||
this.python = execPath | ||
this.checkPythonVersion() | ||
} | ||
}) | ||
} | ||
}.bind(this)) | ||
}, | ||
@@ -377,59 +392,44 @@ // Distributions of Python on Windows by default install with the "py.exe" | ||
// where the actual "python.exe" executable is located. | ||
function checkPythonLauncher () { | ||
log.verbose('could not find "' + python + '". checking python launcher') | ||
var env = extend({}, process.env) | ||
checkPythonLauncher: function checkPythonLauncher () { | ||
this.checkPythonLauncherDepth += 1 | ||
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'] | ||
execFile('py.exe', launcherArgs, { env: env }, function (err, stdout) { | ||
this.execFile('py.exe', launcherArgs, { env: env }, function (err, stdout) { | ||
if (err) { | ||
guessPython() | ||
return | ||
this.guessPython() | ||
} else { | ||
this.python = stdout.trim() | ||
this.log.verbose('check python launcher', | ||
'python executable found: %j', | ||
this.python) | ||
this.checkPythonVersion() | ||
} | ||
python = stdout.trim() | ||
log.verbose('check python launcher', 'python executable found: %j', python) | ||
checkPythonVersion() | ||
}) | ||
} | ||
this.checkPythonLauncherDepth -= 1 | ||
}.bind(this)) | ||
}, | ||
// Called on Windows when "python" isn't available in the current $PATH. | ||
// We're gonna check if "%SystemDrive%\python27\python.exe" exists. | ||
function guessPython () { | ||
log.verbose('could not find "' + python + '". guessing location') | ||
var rootDir = process.env.SystemDrive || 'C:\\' | ||
if (rootDir[rootDir.length - 1] !== '\\') { | ||
rootDir += '\\' | ||
} | ||
var pythonPath = path.resolve(rootDir, 'Python27', 'python.exe') | ||
log.verbose('ensuring that file exists:', pythonPath) | ||
fs.stat(pythonPath, function (err, stat) { | ||
if (err) { | ||
if (err.code == 'ENOENT') { | ||
failNoPython() | ||
} else { | ||
callback(err) | ||
} | ||
return | ||
} | ||
python = pythonPath | ||
checkPythonVersion() | ||
}) | ||
} | ||
function checkPythonVersion () { | ||
var env = extend({}, process.env) | ||
checkPythonVersion: function checkPythonVersion () { | ||
var args = ['-c', 'import platform; print(platform.python_version());'] | ||
var env = extend({}, this.env) | ||
env.TERM = 'dumb' | ||
execFile(python, ['-c', 'import platform; print(platform.python_version());'], { env: env }, function (err, stdout) { | ||
this.execFile(this.python, args, { env: env }, function (err, stdout) { | ||
if (err) { | ||
return callback(err) | ||
return this.callback(err) | ||
} | ||
log.verbose('check python version', '`%s -c "import platform; print(platform.python_version());"` returned: %j', python, stdout) | ||
this.log.verbose('check python version', | ||
'`%s -c "' + args[1] + '"` returned: %j', | ||
this.python, stdout) | ||
var version = stdout.trim() | ||
if (~version.indexOf('+')) { | ||
log.silly('stripping "+" sign(s) from version') | ||
this.log.silly('stripping "+" sign(s) from version') | ||
version = version.replace(/\+/g, '') | ||
} | ||
if (~version.indexOf('rc')) { | ||
log.silly('stripping "rc" identifier from version') | ||
this.log.silly('stripping "rc" identifier from version') | ||
version = version.replace(/rc(.*)$/ig, '') | ||
@@ -442,22 +442,59 @@ } | ||
} catch (e) { | ||
log.silly('range.test() error', e) | ||
this.log.silly('range.test() error', e) | ||
} | ||
if (valid) { | ||
callback(null, python) | ||
this.callback(null, this.python) | ||
} else if (this.win && this.checkPythonLauncherDepth === 0) { | ||
this.checkPythonLauncher() | ||
} else { | ||
failPythonVersion(version) | ||
this.failPythonVersion(version) | ||
} | ||
}) | ||
} | ||
}.bind(this)) | ||
}, | ||
function failNoPython () { | ||
callback(new Error('Can\'t find Python executable "' + python + | ||
'", you can set the PYTHON env variable.')) | ||
} | ||
failNoPython: function failNoPython () { | ||
var errmsg = | ||
'Can\'t find Python executable "' + this.python + | ||
'", you can set the PYTHON env variable.' | ||
this.callback(new Error(errmsg)) | ||
}, | ||
function failPythonVersion (badVersion) { | ||
callback(new Error('Python executable "' + 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.')) | ||
} | ||
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)) | ||
}, | ||
// 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 resolve = path.win32 && path.win32.resolve || path.resolve | ||
var pythonPath = resolve(rootDir, 'Python27', 'python.exe') | ||
this.log.verbose('ensuring that file exists:', pythonPath) | ||
this.stat(pythonPath, function (err, stat) { | ||
if (err) { | ||
if (err.code == 'ENOENT') { | ||
this.failNoPython() | ||
} else { | ||
this.callback(err) | ||
} | ||
return | ||
} | ||
this.python = pythonPath | ||
this.checkPythonVersion() | ||
}.bind(this)) | ||
}, | ||
} | ||
function findPython (python, callback) { | ||
var finder = new PythonFinder(python, callback) | ||
finder.checkPython() | ||
} |
@@ -49,14 +49,3 @@ | ||
// set the dir where node-gyp dev files get installed | ||
// TODO: make this *more* configurable? | ||
// see: https://github.com/nodejs/node-gyp/issues/21 | ||
var homeDir = process.env.HOME || process.env.USERPROFILE | ||
if (!homeDir) { | ||
throw new Error( | ||
"node-gyp requires that the user's home directory is specified " + | ||
"in either of the environmental variables HOME or USERPROFILE" | ||
); | ||
} | ||
this.devDir = path.resolve(homeDir, '.node-gyp') | ||
this.devDir = '' | ||
this.commands = {} | ||
@@ -96,2 +85,3 @@ | ||
, proxy: String // 'install' | ||
, devdir: String // everywhere | ||
, nodedir: String // 'configure' | ||
@@ -98,0 +88,0 @@ , loglevel: String // everywhere |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"installVersion": 9, | ||
@@ -32,5 +32,4 @@ "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)", | ||
"nopt": "2 || 3", | ||
"npmlog": "0 || 1 || 2 || 3", | ||
"npmlog": "0 || 1 || 2 || 3 || 4", | ||
"osenv": "0", | ||
"path-array": "^1.0.0", | ||
"request": "2", | ||
@@ -37,0 +36,0 @@ "rimraf": "2", |
@@ -45,11 +45,13 @@ node-gyp | ||
* On Windows: | ||
* Visual C++ Build Environment: | ||
* Option 1: Install [Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools) using the **Default Install** option. | ||
* Option 1: Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global --production windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). | ||
* Option 2: Install tools and configuration manually: | ||
* Visual C++ Build Environment: | ||
* Option 1: Install [Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools) using the **Default Install** option. | ||
* Option 2: Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or modify an existing installation) and select *Common Tools for Visual C++* during setup. This also works with the free Community and Express for Desktop editions. | ||
* Option 2: Install [Visual Studio 2015](https://www.visualstudio.com/products/visual-studio-community-vs) (or modify an existing installation) and select *Common Tools for Visual C++* during setup. This also works with the free Community and Express for Desktop editions. | ||
> :bulb: [Windows Vista / 7 only] requires [.NET Framework 4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773) | ||
> :bulb: [Windows Vista / 7 only] requires [.NET Framework 4.5.1](http://www.microsoft.com/en-us/download/details.aspx?id=40773) | ||
* Install [Python 2.7](https://www.python.org/downloads/) (`v3.x.x` is not supported), and run `npm config set python python2.7` (or see below for further instructions on specifying the proper Python version and path.) | ||
* Launch cmd, `npm config set msvs_version 2015` | ||
* Install [Python 2.7](https://www.python.org/downloads/) (`v3.x.x` is not supported), and run `npm config set python python2.7` (or see below for further instructions on specifying the proper Python version and path.) | ||
* Launch cmd, `npm config set msvs_version 2015` | ||
@@ -177,2 +179,3 @@ If the above steps didn't work for you, please visit [Microsoft's Node.js Guidelines for Windows](https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules) for additional tips. | ||
| `--tarball=$path` | Get headers from a local tarball | ||
| `--devdir=$path` | SDK download directory (default=~/.node-gyp) | ||
| `--ensure` | Don't reinstall headers if already present | ||
@@ -179,0 +182,0 @@ | `--dist-url=$url` | Download header tarball from custom URL |
@@ -6,4 +6,5 @@ 'use strict' | ||
var execFile = require('child_process').execFile | ||
var PythonFinder = configure.test.PythonFinder | ||
test('find python executable', function (t) { | ||
test('find python', function (t) { | ||
t.plan(4) | ||
@@ -22,1 +23,307 @@ | ||
}) | ||
function poison(object, property) { | ||
function fail() { | ||
throw new Error('Property ' + property + ' should not have been accessed.') | ||
} | ||
var descriptor = { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
getter: fail, | ||
setter: fail, | ||
} | ||
Object.defineProperty(object, property, descriptor) | ||
} | ||
function TestPythonFinder() { PythonFinder.apply(this, arguments) } | ||
TestPythonFinder.prototype = Object.create(PythonFinder.prototype) | ||
poison(TestPythonFinder.prototype, 'env') | ||
poison(TestPythonFinder.prototype, 'execFile') | ||
poison(TestPythonFinder.prototype, 'stat') | ||
poison(TestPythonFinder.prototype, 'which') | ||
poison(TestPythonFinder.prototype, 'win') | ||
test('find python - python', function (t) { | ||
t.plan(5) | ||
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 platform/.test(args[1])) | ||
cb(null, '2.7.0') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.strictEqual(err, null) | ||
t.strictEqual(python, 'python') | ||
} | ||
}) | ||
test('find python - python too old', function (t) { | ||
t.plan(4) | ||
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 platform/.test(args[1])) | ||
cb(null, '2.3.4') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.ok(/is not supported by gyp/.test(err)) | ||
} | ||
}) | ||
test('find python - python too new', function (t) { | ||
t.plan(4) | ||
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 platform/.test(args[1])) | ||
cb(null, '3.0.0') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.ok(/is not supported by gyp/.test(err)) | ||
} | ||
}) | ||
test('find python - no python', function (t) { | ||
t.plan(2) | ||
var f = new TestPythonFinder('python', done) | ||
f.which = function(program, cb) { | ||
t.strictEqual(program, 'python') | ||
cb(new Error('not found')) | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.ok(/Can't find Python executable/.test(err)) | ||
} | ||
}) | ||
test('find python - no python2', function (t) { | ||
t.plan(6) | ||
var f = new TestPythonFinder('python2', done) | ||
f.which = function(program, cb) { | ||
f.which = function(program, cb) { | ||
t.strictEqual(program, 'python') | ||
cb(null, program) | ||
} | ||
t.strictEqual(program, 'python2') | ||
cb(new Error('not found')) | ||
} | ||
f.execFile = function(program, args, opts, cb) { | ||
t.strictEqual(program, 'python') | ||
t.ok(/import platform/.test(args[1])) | ||
cb(null, '2.7.0') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.strictEqual(err, null) | ||
t.strictEqual(python, 'python') | ||
} | ||
}) | ||
test('find python - no python2, no python, unix', function (t) { | ||
t.plan(3) | ||
var f = new TestPythonFinder('python2', done) | ||
poison(f, 'checkPythonLauncher') | ||
f.win = false | ||
f.which = function(program, cb) { | ||
f.which = function(program, cb) { | ||
t.strictEqual(program, 'python') | ||
cb(new Error('not found')) | ||
} | ||
t.strictEqual(program, 'python2') | ||
cb(new Error('not found')) | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.ok(/Can't find Python executable/.test(err)) | ||
} | ||
}) | ||
test('find python - no python, use python launcher', function (t) { | ||
t.plan(8) | ||
var f = new TestPythonFinder('python', done) | ||
f.env = {} | ||
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 platform/.test(args[1])) | ||
cb(null, '2.7.0') | ||
} | ||
t.strictEqual(program, 'py.exe') | ||
t.notEqual(args.indexOf('-2'), -1) | ||
t.notEqual(args.indexOf('-c'), -1) | ||
cb(null, 'Z:\\snake.exe') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.strictEqual(err, null) | ||
t.strictEqual(python, 'Z:\\snake.exe') | ||
} | ||
}) | ||
test('find python - python 3, use python launcher', function (t) { | ||
t.plan(10) | ||
var f = new TestPythonFinder('python', done) | ||
f.env = {} | ||
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) { | ||
f.execFile = function(program, args, opts, cb) { | ||
t.strictEqual(program, 'Z:\\snake.exe') | ||
t.ok(/import platform/.test(args[1])) | ||
cb(null, '2.7.0') | ||
} | ||
t.strictEqual(program, 'py.exe') | ||
t.notEqual(args.indexOf('-2'), -1) | ||
t.notEqual(args.indexOf('-c'), -1) | ||
cb(null, 'Z:\\snake.exe') | ||
} | ||
t.strictEqual(program, 'python') | ||
t.ok(/import platform/.test(args[1])) | ||
cb(null, '3.0.0') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.strictEqual(err, null) | ||
t.strictEqual(python, 'Z:\\snake.exe') | ||
} | ||
}) | ||
test('find python - python 3, use python launcher, python 2 too old', | ||
function (t) { | ||
t.plan(9) | ||
var f = new TestPythonFinder('python', done) | ||
f.checkedPythonLauncher = false | ||
f.env = {} | ||
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) { | ||
f.execFile = function(program, args, opts, cb) { | ||
t.strictEqual(program, 'Z:\\snake.exe') | ||
t.ok(/import platform/.test(args[1])) | ||
cb(null, '2.3.4') | ||
} | ||
t.strictEqual(program, 'py.exe') | ||
t.notEqual(args.indexOf('-2'), -1) | ||
t.notEqual(args.indexOf('-c'), -1) | ||
cb(null, 'Z:\\snake.exe') | ||
} | ||
t.strictEqual(program, 'python') | ||
t.ok(/import platform/.test(args[1])) | ||
cb(null, '3.0.0') | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.ok(/is not supported by gyp/.test(err)) | ||
} | ||
}) | ||
test('find python - no python, no python launcher, good guess', function (t) { | ||
t.plan(6) | ||
var re = /C:[\\\/]Python27[\\\/]python[.]exe/ | ||
var f = new TestPythonFinder('python', done) | ||
f.env = {} | ||
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 platform/.test(args[1])) | ||
cb(null, '2.7.0') | ||
} | ||
t.strictEqual(program, 'py.exe') | ||
cb(new Error('not found')) | ||
} | ||
f.stat = function(path, cb) { | ||
t.ok(re.test(path)) | ||
cb(null, {}) | ||
} | ||
f.checkPython() | ||
function done(err, python) { | ||
t.ok(re.test(python)) | ||
} | ||
}) | ||
test('find python - no python, no python launcher, bad guess', function (t) { | ||
t.plan(4) | ||
var f = new TestPythonFinder('python', done) | ||
f.env = { SystemDrive: 'Z:\\' } | ||
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')) | ||
} | ||
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() | ||
function done(err, python) { | ||
t.ok(/Can't find Python executable/.test(err)) | ||
} | ||
}) |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
1649513
13
2880
220
51
+ Addedgauge@2.7.4(transitive)
+ Addednpmlog@4.1.2(transitive)
- Removedpath-array@^1.0.0
- Removedarray-index@1.0.0(transitive)
- Removedd@1.0.2(transitive)
- Removeddebug@2.6.9(transitive)
- Removedes5-ext@0.10.64(transitive)
- Removedes6-iterator@2.0.3(transitive)
- Removedes6-symbol@3.1.4(transitive)
- Removedesniff@2.0.1(transitive)
- Removedevent-emitter@0.3.5(transitive)
- Removedext@1.7.0(transitive)
- Removedgauge@2.6.0(transitive)
- Removedhas-color@0.1.7(transitive)
- Removedms@2.0.0(transitive)
- Removednext-tick@1.1.0(transitive)
- Removednpmlog@3.1.2(transitive)
- Removedpath-array@1.0.1(transitive)
- Removedtype@2.7.3(transitive)
Updatednpmlog@0 || 1 || 2 || 3 || 4