diff options
author | isaacs <i@izs.me> | 2012-03-23 03:29:29 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-03-23 03:29:29 +0400 |
commit | 3f252649acd73223232787414d91715d40605082 (patch) | |
tree | cbfca54e66df22619583afef5a781cd169723d30 | |
parent | a4bfc7e373a3c60bfc0e53c071b63cf7ae659aed (diff) |
Update node-gyp to 0.3.7
11 files changed, 193 insertions, 96 deletions
diff --git a/node_modules/node-gyp/lib/build.js b/node_modules/node-gyp/lib/build.js index f6c63a6f7..3ffc4c791 100644 --- a/node_modules/node-gyp/lib/build.js +++ b/node_modules/node-gyp/lib/build.js @@ -36,7 +36,14 @@ function build (gyp, argv, callback) { function loadConfigGypi () { fs.readFile(configPath, 'utf8', function (err, data) { - if (err) return callback(err) + if (err) { + if (err.code == 'ENOENT') { + callback(new Error('You must run `node-gyp configure` first!')) + } else { + callback(err) + } + return + } config = JSON.parse(data.replace(/\#.+\n/, '')) if (win) { findSolutionFile() @@ -112,7 +119,7 @@ function build (gyp, argv, callback) { function build () { var buildType = config.target_defaults.default_configuration - , platform = config.target_arch == 'x64' ? '64' : '32' + , platform = config.variables.target_arch == 'x64' ? '64' : '32' if (gyp.opts.debug) { buildType = 'Debug' diff --git a/node_modules/node-gyp/lib/configure.js b/node_modules/node-gyp/lib/configure.js index ac204b15e..c1c99e7d9 100644 --- a/node_modules/node-gyp/lib/configure.js +++ b/node_modules/node-gyp/lib/configure.js @@ -92,13 +92,16 @@ function configure (gyp, argv, callback) { if (!version) { return callback(new Error('Invalid version number: ' + versionStr)) } - version = version.slice(1, 4).join('.') gyp.opts.ensure = true - gyp.commands.install([ version ], createBuildDir) + gyp.commands.install([ versionStr ], function (err, _version) { + if (err) return callback(err) + version = _version + gyp.verbose('setting target version to:', version) + createBuildDir() + }) } - function createBuildDir (err) { - if (err) return callback(err) + function createBuildDir () { gyp.verbose('attempting to create "build" dir', buildDir) mkdirp(buildDir, function (err, isNew) { if (err) return callback(err) diff --git a/node_modules/node-gyp/lib/install.js b/node_modules/node-gyp/lib/install.js index e064fbc14..e9328a9cd 100644 --- a/node_modules/node-gyp/lib/install.js +++ b/node_modules/node-gyp/lib/install.js @@ -33,7 +33,7 @@ function install (gyp, argv, callback) { callback(err) }) } else { - callback.apply(null, arguments) + callback(null, version) } } @@ -60,6 +60,7 @@ function install (gyp, argv, callback) { if (version[5] === '-pre') { version[3] = +version[3] - 1 version[5] = null + gyp.verbose('-pre version detected, adjusting patch version') } // flatten version into String @@ -80,7 +81,7 @@ function install (gyp, argv, callback) { gyp.verbose('version not already installed, continuing with install', version) go() } else { - callback(err) + cb(err) } return } @@ -88,7 +89,7 @@ function install (gyp, argv, callback) { var installVersionFile = path.resolve(devDir, 'installVersion') fs.readFile(installVersionFile, 'ascii', function (err, ver) { if (err && err.code != 'ENOENT') { - return callback(err) + return cb(err) } var installVersion = parseInt(ver, 10) || 0 gyp.verbose('got "installVersion":', installVersion) @@ -98,7 +99,7 @@ function install (gyp, argv, callback) { go() } else { gyp.verbose('version is good') - callback() + cb() } }) }) @@ -106,6 +107,18 @@ function install (gyp, argv, callback) { go() } + function download(url,onError) { + gyp.info('downloading:', url) + requestOpts = { uri: url } + + // basic support for a proxy server + var proxyUrl = gyp.opts.proxy || process.env.http_proxy || process.env.HTTP_PROXY + if (proxyUrl) { + gyp.verbose('using proxy:', proxyUrl) + requestOpts.proxy = proxyUrl + } + return request(requestOpts, onError) + } function go () { @@ -120,22 +133,35 @@ function install (gyp, argv, callback) { var tarballUrl = distUrl + '/v' + version + '/node-v' + version + '.tar.gz' , badDownload = false , extractCount = 0 - , parser = tar.Parse() - - gyp.info('downloading:', tarballUrl) - - var requestOpts = { uri: tarballUrl } - var proxyUrl = gyp.opts.proxy || process.env.http_proxy || process.env.HTTP_PROXY - if (proxyUrl) { - gyp.verbose('using proxy:', proxyUrl) - requestOpts.proxy = proxyUrl + , gunzip = zlib.createGunzip() + , extracter = tar.Extract({ path: devDir, strip: 1, filter: isValid }) + + // checks if a file to be extracted from the tarball is valid. + // only .h header files and the gyp files get extracted + function isValid () { + var name = this.path.substring(devDir.length + 1) + , _valid = valid(name) + if (name === '' && this.type === 'Directory') { + // the first directory entry is ok + return true + } + if (_valid) { + gyp.verbose('extracted file from tarball', name) + extractCount++ + } else { + // invalid + } + return _valid } - request(requestOpts, downloadError) - .pipe(zlib.createGunzip()) - .pipe(parser) - parser.on('entry', onEntry) - parser.on('end', afterTarball) + gunzip.on('error', cb) + extracter.on('error', cb) + extracter.on('end', afterTarball) + + // download the tarball, gunzip and extract! + var req = download(tarballUrl, downloadError) + .pipe(gunzip) + .pipe(extracter) // something went wrong downloading the tarball? function downloadError (err, res) { @@ -145,53 +171,11 @@ function install (gyp, argv, callback) { } } - // handle a file from the tarball - function onEntry (entry) { - extractCount++ - - var filename = entry.props.path - , trimmed = install.trim(filename) - - if (!valid(trimmed)) { - // skip - return - } - - var dir = path.dirname(trimmed) - , devFileDir = path.resolve(devDir, dir) - , devFile = path.resolve(devDir, trimmed) - - if (dir !== '.') { - // TODO: async - // TODO: keep track of the dirs that have been created/checked so far - //console.error(devFileDir) - mkdir.sync(devFileDir) - } - // TODO: better "File" detection or use `fstream` - if (entry.props.type !== '0') { - return - } - //console.error(trimmed, entry.props) - - // Finally save the file to the filesystem - // TODO: Figure out why pipe() hangs here or use `fstream` - var ws = fs.createWriteStream(devFile, { - mode: entry.props.mode - }) - entry.on('data', function (b) { - ws.write(b) - }) - entry.on('end', function () { - ws.end() - gyp.verbose('saved file', devFile) - }) - - } - + // invoked after the tarball has finished being extracted function afterTarball () { if (badDownload) return if (extractCount === 0) { - return cb(new Error('There was a fatal problem while downloading the tarball')) + return cb(new Error('There was a fatal problem while downloading/extracting the tarball')) } gyp.verbose('done parsing tarball') var async = 0 @@ -265,10 +249,9 @@ function install (gyp, argv, callback) { if (err) return done(err) mkdir(debugDir, function (err) { if (err) return done(err) - gyp.info('downloading `node.lib`', nodeLibUrl) // TODO: clean this mess up, written in a hastemode-9000 var badDownload = false - var res = request(nodeLibUrl, function (err, res) { + var res = download(nodeLibUrl, function (err, res) { if (err || res.statusCode != 200) { badDownload = true done(err || new Error(res.statusCode + ' status code downloading node.lib')) diff --git a/node_modules/node-gyp/node_modules/ansi/package.json b/node_modules/node-gyp/node_modules/ansi/package.json index a7298944b..b6dfe6fda 100644 --- a/node_modules/node-gyp/node_modules/ansi/package.json +++ b/node_modules/node-gyp/node_modules/ansi/package.json @@ -41,8 +41,11 @@ "dependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.8", + "_npmVersion": "1.1.11", "_nodeVersion": "v0.7.7-pre", "_defaultsLoaded": true, + "dist": { + "shasum": "926ed94f0865d5732789819999b432c57bbed0ec" + }, "_from": "ansi@0.0.x" } diff --git a/node_modules/node-gyp/node_modules/glob/LICENCE b/node_modules/node-gyp/node_modules/glob/LICENCE new file mode 100644 index 000000000..74489e2e2 --- /dev/null +++ b/node_modules/node-gyp/node_modules/glob/LICENCE @@ -0,0 +1,25 @@ +Copyright (c) Isaac Z. Schlueter +All rights reserved. + +The BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/node-gyp/node_modules/glob/glob.js b/node_modules/node-gyp/node_modules/glob/glob.js index 48262b59c..aba4ef678 100644 --- a/node_modules/node-gyp/node_modules/glob/glob.js +++ b/node_modules/node-gyp/node_modules/glob/glob.js @@ -44,6 +44,7 @@ var fs = require("graceful-fs") , path = require("path") , isDir = {} , assert = require("assert").ok +, EOF = {} function glob (pattern, options, cb) { if (typeof options === "function") cb = options, options = {} @@ -157,7 +158,7 @@ function Glob (pattern, options, cb) { this._process(pattern, 0, i, function (er) { if (er) this.emit("error", er) if (-- n <= 0) this._finish() - }.bind(this)) + }) } } @@ -210,8 +211,8 @@ Glob.prototype._finish = function () { if (this.debug) console.error("emitting end", all) - this.found = all - this.emit("end", all) + EOF = this.found = all + this.emitMatch(EOF) } function alphasorti (a, b) { @@ -229,10 +230,67 @@ Glob.prototype.abort = function () { this.emit("abort") } +Glob.prototype.pause = function () { + if (this.paused) return + if (this.sync) + this.emit("error", new Error("Can't pause/resume sync glob")) + this.paused = true + this.emit("pause") +} + +Glob.prototype.resume = function () { + if (!this.paused) return + if (this.sync) + this.emit("error", new Error("Can't pause/resume sync glob")) + this.paused = false + this.emit("resume") +} + + +Glob.prototype.emitMatch = function (m) { + if (!this.paused) { + this.emit(m === EOF ? "end" : "match", m) + return + } + + if (!this._emitQueue) { + this._emitQueue = [] + this.once("resume", function () { + var q = this._emitQueue + this._emitQueue = null + q.forEach(function (m) { + this.emitMatch(m) + }, this) + }) + } + + this._emitQueue.push(m) + + //this.once("resume", this.emitMatch.bind(this, m)) +} + + -Glob.prototype._process = function (pattern, depth, index, cb) { +Glob.prototype._process = function (pattern, depth, index, cb_) { assert(this instanceof Glob) - cb = cb.bind(this) + + var cb = function cb (er, res) { + assert(this instanceof Glob) + if (this.paused) { + if (!this._processQueue) { + this._processQueue = [] + this.once("resume", function () { + var q = this._processQueue + this._processQueue = null + q.forEach(function (cb) { cb() }) + }) + } + this._processQueue.push(cb_.bind(this, er, res)) + } else { + cb_.call(this, er, res) + } + }.bind(this) + if (this.aborted) return cb() if (depth > this.maxDepth) return cb() @@ -259,7 +317,7 @@ Glob.prototype._process = function (pattern, depth, index, cb) { } this.matches[index] = this.matches[index] || {} this.matches[index][prefix] = true - this.emit("match", prefix) + this.emitMatch(prefix) } return cb() }) @@ -358,7 +416,7 @@ Glob.prototype._process = function (pattern, depth, index, cb) { this.matches[index] = this.matches[index] || {} this.matches[index][e] = true - this.emit("match", e) + this.emitMatch(e) }, this) return cb.call(this) } @@ -375,7 +433,7 @@ Glob.prototype._process = function (pattern, depth, index, cb) { if (errState) return if (er) return cb(errState = er) if (--l === 0) return cb.call(this) - }.bind(this)) + }) }, this) }) @@ -418,6 +476,7 @@ Glob.prototype._stat = function (f, cb) { } Glob.prototype._afterStat = function (f, abs, cb, er, stat) { + var exists assert(this instanceof Glob) if (er || !stat) { exists = false diff --git a/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md b/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md index d5f97234c..6fd07d2e9 100644 --- a/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md +++ b/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/README.md @@ -60,11 +60,12 @@ thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but `a/**b` will not. **Note that this is different from the way that `**` is handled by ruby's `Dir` class.** -If an escaped pattern has no matches, and the `null` flag is not set, +If an escaped pattern has no matches, and the `nonull` flag is set, then minimatch.match returns the pattern as-provided, rather than interpreting the character escapes. For example, `minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than -`"*a?"`. +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. If brace expansion is not disabled, then it is performed before any other interpretation of the glob pattern. Thus, a pattern like @@ -147,8 +148,8 @@ var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) ### minimatch.match(list, pattern, options) Match against the list of -files, in the style of fnmatch or glob. If nothing is matched, then -return the pattern (unless `{ null: true }` in the options.) +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. ```javascript var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) @@ -210,3 +211,8 @@ comment. ### nonegate Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) diff --git a/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js b/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js index 737c82e71..1ca08104e 100644 --- a/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js +++ b/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/minimatch.js @@ -4,7 +4,6 @@ minimatch.Minimatch = Minimatch var LRU = require("lru-cache") , cache = minimatch.cache = new LRU(100) , GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} - , pathSplit = process.platform === "win32" ? /\\|\// : "/" var path = require("path") // any single thing other than / @@ -519,7 +518,8 @@ function parse (pattern, isSub) { patternListStack.push({ type: plType , start: i - 1 , reStart: re.length }) - re += stateChar === "!" ? "(?!" : "(?:" + // negation is (?:(?!js)[^/]*) + re += stateChar === "!" ? "(?:(?!" : "(?:" stateChar = false continue @@ -532,11 +532,15 @@ function parse (pattern, isSub) { hasMagic = true re += ")" plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:<pattern>)<type> switch (plType) { + case "!": + re += "[^/]*?)" + break case "?": case "+": case "*": re += plType - case "!": // already handled by the start case "@": break // the default anyway } continue @@ -791,12 +795,14 @@ function match (f, partial) { var pattern = set[i] var hit = this.matchOne(f, pattern, partial) if (hit) { + if (options.flipNegate) return true return !this.negate } } // didn't get any hits. this is success if it's a negative // pattern, failure otherwise. + if (options.flipNegate) return false return this.negate } diff --git a/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json b/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json index 198273eff..7ca0e02ba 100644 --- a/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json +++ b/node_modules/node-gyp/node_modules/glob/node_modules/minimatch/package.json @@ -6,7 +6,7 @@ }, "name": "minimatch", "description": "a glob matcher in javascript", - "version": "0.2.0", + "version": "0.2.2", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" @@ -22,7 +22,7 @@ "lru-cache": "~1.0.5" }, "devDependencies": { - "tap": "~0.1.3" + "tap": "" }, "licenses": [ { @@ -34,10 +34,10 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "minimatch@0.2.0", + "_id": "minimatch@0.2.2", "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.8", + "_npmVersion": "1.1.11", "_nodeVersion": "v0.7.7-pre", "_defaultsLoaded": true, "_from": "minimatch@0.2" diff --git a/node_modules/node-gyp/node_modules/glob/package.json b/node_modules/node-gyp/node_modules/glob/package.json index 708953f92..5d8266db7 100644 --- a/node_modules/node-gyp/node_modules/glob/package.json +++ b/node_modules/node-gyp/node_modules/glob/package.json @@ -6,7 +6,7 @@ }, "name": "glob", "description": "a little globber", - "version": "3.1.6", + "version": "3.1.9", "repository": { "type": "git", "url": "git://github.com/isaacs/node-glob.git" @@ -28,14 +28,15 @@ "scripts": { "test": "tap test/*.js" }, + "license": "BSD", "_npmUser": { "name": "isaacs", "email": "i@izs.me" }, - "_id": "glob@3.1.6", + "_id": "glob@3.1.9", "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.8", + "_npmVersion": "1.1.11", "_nodeVersion": "v0.7.7-pre", "_defaultsLoaded": true, "_from": "glob@3" diff --git a/node_modules/node-gyp/package.json b/node_modules/node-gyp/package.json index 27133133a..956d38d16 100644 --- a/node_modules/node-gyp/package.json +++ b/node_modules/node-gyp/package.json @@ -10,7 +10,7 @@ "bindings", "gyp" ], - "version": "0.3.5", + "version": "0.3.7", "installVersion": 5, "author": { "name": "Nathan Rajlich", @@ -29,6 +29,7 @@ "dependencies": { "ansi": "0.0.x", "glob": "3", + "graceful-fs": "1", "fstream": "~0.1.13", "minimatch": "~0.1.4", "mkdirp": "0.3.0", @@ -46,12 +47,15 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "node-gyp@0.3.5", + "_id": "node-gyp@0.3.7", "devDependencies": {}, "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.8", + "_npmVersion": "1.1.11", "_nodeVersion": "v0.7.7-pre", "_defaultsLoaded": true, + "dist": { + "shasum": "0a83feb32683c828537eacd6deeae066d1dc01f1" + }, "_from": "node-gyp@~0.3.4" } |