node-gyp
Advanced tools
Comparing version 0.6.2 to 0.6.3
@@ -25,3 +25,8 @@ #!/usr/bin/env node | ||
if (prog.todo.length === 0) { | ||
return prog.usageAndExit() | ||
if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) { | ||
console.log('v%s', prog.version) | ||
} else { | ||
console.log('%s', prog.usage()) | ||
} | ||
return process.exit(0) | ||
} | ||
@@ -28,0 +33,0 @@ |
@@ -12,2 +12,3 @@ | ||
, log = require('npmlog') | ||
, osenv = require('osenv') | ||
, which = require('which') | ||
@@ -17,3 +18,6 @@ , semver = require('semver') | ||
, exec = require('child_process').exec | ||
, spawn = require('child_process').spawn | ||
, win = process.platform == 'win32' | ||
, hasVCExpress = false | ||
, hasWin71SDK = false | ||
@@ -29,3 +33,14 @@ exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module' | ||
checkPython() | ||
if (win) { | ||
checkVCExpress(function () { | ||
if (hasVCExpress) { | ||
checkWin71SDK(function () { | ||
checkPython() | ||
}) | ||
} else { | ||
checkPython() | ||
} | ||
}) | ||
} else | ||
checkPython() | ||
@@ -78,3 +93,3 @@ // Make sure that Python is in the $PATH | ||
} | ||
log.verbose('check python version', '`python --version` returned: %j', stderr) | ||
log.verbose('check python version', '`%s --version` returned: %j', python, stderr) | ||
var version = stderr.trim().replace(/[^\d\.]+/g, '') | ||
@@ -109,2 +124,29 @@ var numDots = 0 | ||
function checkWin71SDK(cb) { | ||
spawn('reg', ['query', 'HKLM\\Software\\Microsoft\\Microsoft SDKs\\Windows\\v7.1', '/v', 'InstallationFolder']) | ||
.on('exit', function (code) { | ||
hasWin71SDK = (code === 0) | ||
cb() | ||
}) | ||
} | ||
function checkVCExpress64(cb) { | ||
var cp = spawn('cmd', ['/C', '%WINDIR%\\SysWOW64\\reg', 'query', 'HKLM\\Software\\Microsoft\\VCExpress\\10.0\\Setup\\VC', '/v', 'ProductDir']) | ||
cp.on('exit', function (code) { | ||
hasVCExpress = (code === 0) | ||
cb() | ||
}) | ||
} | ||
function checkVCExpress(cb) { | ||
spawn('reg', ['query', 'HKLM\\Software\\Microsoft\\VCExpress\\10.0\\Setup\\VC', '/v', 'ProductDir']) | ||
.on('exit', function (code) { | ||
if (code !== 0) { | ||
checkVCExpress64(cb) | ||
} else { | ||
cb() | ||
} | ||
}) | ||
} | ||
function getNodeDir () { | ||
@@ -117,11 +159,4 @@ | ||
// --nodedir was specified. use that for the dev files | ||
nodeDir = gyp.opts.nodedir | ||
nodeDir = gyp.opts.nodedir.replace(/^~/, osenv.home()) | ||
// simple ~ homedir expansion based on https://github.com/joyent/node/issues/2857 | ||
if (win) { | ||
nodeDir = nodeDir.replace(/^~/, process.env.USERPROFILE) | ||
} else { | ||
nodeDir = nodeDir.replace(/^~/, process.env.HOME) | ||
} | ||
log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir) | ||
@@ -213,2 +248,7 @@ createBuildDir() | ||
// set the toolset for 64-bit VCExpress users | ||
if (win && variables.target_arch === 'x64' && hasVCExpress && hasWin71SDK) { | ||
defaults.msbuild_toolset = 'Windows7.1SDK' | ||
} | ||
// set the node development directory | ||
@@ -215,0 +255,0 @@ variables.nodedir = nodeDir |
@@ -177,6 +177,6 @@ | ||
/** | ||
* Prints the usage instructions and then exits. | ||
* Returns the usage instructions for node-gyp. | ||
*/ | ||
proto.usageAndExit = function usageAndExit () { | ||
proto.usage = function usage () { | ||
var usage = [ | ||
@@ -197,9 +197,7 @@ '' | ||
].join('\n') | ||
console.log(usage) | ||
process.exit(4) | ||
return usage | ||
} | ||
/** | ||
* Version number proxy. | ||
* Version number getter. | ||
*/ | ||
@@ -206,0 +204,0 @@ |
{ "name": "node-gyp" | ||
, "description": "Node.js native addon build tool" | ||
, "keywords": [ "native", "addon", "module", "c", "c++", "bindings", "gyp" ] | ||
, "version": "0.6.2" | ||
, "version": "0.6.3" | ||
, "installVersion": 9 | ||
@@ -6,0 +6,0 @@ , "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)" |
921203
1223
18
3