diff options
author | isaacs <i@izs.me> | 2012-06-15 20:27:41 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-06-15 20:27:41 +0400 |
commit | 7fa19049310eed9d766f10fb6e6edd9101676515 (patch) | |
tree | 6a9de4b69d411135f8195230fcaa38251b47b477 /node_modules/node-gyp/lib/configure.js | |
parent | 8689ba87305fb49025f73f9fc4a10dbce070f22d (diff) |
Update node-gyp to 0.5
Diffstat (limited to 'node_modules/node-gyp/lib/configure.js')
-rw-r--r-- | node_modules/node-gyp/lib/configure.js | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js index ca0da39e9..a320f208e 100644 --- a/node_modules/node-gyp/lib/configure.js +++ b/node_modules/node-gyp/lib/configure.js @@ -8,9 +8,10 @@ module.exports = exports = configure var fs = require('graceful-fs') , path = require('path') , glob = require('glob') + , log = require('npmlog') , which = require('which') , semver = require('semver') - , mkdirp = require('./util/mkdirp') + , mkdirp = require('mkdirp') , win = process.platform == 'win32' exports.usage = 'Generates ' + (win ? 'MSVC project files' : 'a Makefile') + ' for the current module' @@ -26,7 +27,7 @@ function configure (gyp, argv, callback) { // Make sure that Python is in the $PATH function checkPython () { - gyp.verbose('checking for Python executable "' + python + '" in the PATH') + log.verbose('check python', 'checking for Python executable "%s" in the PATH', python) which(python, function (err, execPath) { if (err) { if (win) { @@ -36,7 +37,7 @@ function configure (gyp, argv, callback) { } return } - gyp.verbose('`which` succeeded for `' + python + '`', execPath) + log.verbose('`which` succeeded for `' + python + '`', execPath) // TODO: ensure compatible Python version getNodeDir() }) @@ -45,13 +46,13 @@ function configure (gyp, argv, callback) { // Called on Windows when "python" isn't available in the current $PATH. // We're gonna glob C:\python2* function guessPython () { - gyp.verbose('could not find "' + python + '". guessing location') + log.verbose('could not find "' + python + '". guessing location') var rootDir = process.env.HOMEDRIVE || process.env.SystemDrive || 'C:\\' if (rootDir[rootDir.length - 1] !== '\\') { rootDir += '\\' } var pythonPath = path.resolve(rootDir, 'Python27', 'python.exe') - gyp.verbose('ensuring that file exists:', pythonPath) + log.verbose('ensuring that file exists:', pythonPath) fs.stat(pythonPath, function (err, stat) { if (err) { if (err.code == 'ENOENT') { @@ -87,7 +88,7 @@ function configure (gyp, argv, callback) { nodeDir = nodeDir.replace(/^~/, process.env.HOME) } - gyp.verbose('compiling against specified --nodedir dev files', nodeDir) + log.verbose('get node dir', 'compiling against specified --nodedir dev files: %s', nodeDir) createBuildDir() } else { @@ -98,11 +99,11 @@ function configure (gyp, argv, callback) { if (gyp.opts.target) { // if --target was given, then determine a target version to compile for versionStr = gyp.opts.target - gyp.verbose('compiling against --target node version', versionStr) + log.verbose('get node dir', 'compiling against --target node version: %s', versionStr) } else { // if no --target was specified then use the current host node version versionStr = process.version - gyp.verbose('no --target version specified, falling back to host node version', versionStr) + log.verbose('get node dir', 'no --target version specified, falling back to host node version: %s', versionStr) } // make sure we have a valid version @@ -115,7 +116,7 @@ function configure (gyp, argv, callback) { gyp.opts.ensure = true gyp.commands.install([ versionStr ], function (err, version) { if (err) return callback(err) - gyp.verbose('target node version installed:', version) + log.verbose('get node dir', 'target node version installed:', version) nodeDir = path.resolve(gyp.devDir, version) createBuildDir() }) @@ -123,19 +124,21 @@ function configure (gyp, argv, callback) { } function createBuildDir () { - gyp.verbose('attempting to create "build" dir', buildDir) + log.verbose('build dir', 'attempting to create "build" dir: %s', buildDir) mkdirp(buildDir, function (err, isNew) { if (err) return callback(err) - gyp.verbose('"build" dir needed to be created?', isNew) + log.verbose('build dir', '"build" dir needed to be created?', isNew) createConfigFile() }) } function createConfigFile (err) { if (err) return callback(err) - gyp.verbose('creating build/config.gypi file') - configPath = path.resolve(buildDir, 'config.gypi') + var configFilename = 'config.gypi' + configPath = path.resolve(buildDir, configFilename) + + log.verbose(configFilename, 'creating config file') var config = process.config || {} , defaults = config.target_defaults @@ -194,10 +197,12 @@ function configure (gyp, argv, callback) { return v } + log.silly(configFilename, config) + // now write out the config.gypi file to the build/ dir var prefix = '# Do not edit. File was generated by node-gyp\'s "configure" step' , json = JSON.stringify(config, boolsToString, 2) - gyp.verbose('writing out config file', configPath) + log.verbose(configFilename, 'writing out config file: %s', configPath) fs.writeFile(configPath, [prefix, json, ''].join('\n'), runGypAddon) } @@ -209,11 +214,11 @@ function configure (gyp, argv, callback) { if (!~argv.indexOf('-f') && !~argv.indexOf('--format')) { if (win) { - gyp.verbose('gyp format was not specified; forcing "msvs"') + log.verbose('gyp_addon', 'gyp format was not specified; forcing "msvs"') // force the 'make' target for non-Windows argv.push('-f', 'msvs') } else { - gyp.verbose('gyp format was not specified; forcing "make"') + log.verbose('gyp_addon', 'gyp format was not specified; forcing "make"') // force the 'make' target for non-Windows argv.push('-f', 'make') } |