From 54cc3c708c15d467521a451012640606609e4385 Mon Sep 17 00:00:00 2001 From: Emerson Knapp <537409+emersonknapp@users.noreply.github.com> Date: Tue, 6 Apr 2021 13:19:57 -0700 Subject: [PATCH] Revert "Update colcon-* versions (#361)" (#373) This reverts commit 18ce369950c438eb8c8afe970e7b173a5e12b2cd. Signed-off-by: Emerson Knapp --- dist/index.js | 163 ++++++++++++++++++++++--------------- package-lock.json | 3 +- src/package_manager/pip.ts | 22 ++--- 3 files changed, 108 insertions(+), 80 deletions(-) diff --git a/dist/index.js b/dist/index.js index ec74d95ec..86e7eb61a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -63,11 +63,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const childProcess = __webpack_require__(129); -const path = __webpack_require__(622); +const childProcess = __importStar(__webpack_require__(129)); +const path = __importStar(__webpack_require__(622)); const util_1 = __webpack_require__(669); -const ioUtil = __webpack_require__(672); +const ioUtil = __importStar(__webpack_require__(672)); const exec = util_1.promisify(childProcess.exec); /** * Copies a file or folder. @@ -235,58 +242,73 @@ function which(tool, check) { throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`); } } + return result; } - try { - // build the list of extensions to try - const extensions = []; - if (ioUtil.IS_WINDOWS && process.env.PATHEXT) { - for (const extension of process.env.PATHEXT.split(path.delimiter)) { - if (extension) { - extensions.push(extension); - } - } - } - // if it's rooted, return it if exists. otherwise return empty. - if (ioUtil.isRooted(tool)) { - const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); - if (filePath) { - return filePath; + const matches = yield findInPath(tool); + if (matches && matches.length > 0) { + return matches[0]; + } + return ''; + }); +} +exports.which = which; +/** + * Returns a list of all occurrences of the given tool on the system path. + * + * @returns Promise the paths of the tool + */ +function findInPath(tool) { + return __awaiter(this, void 0, void 0, function* () { + if (!tool) { + throw new Error("parameter 'tool' is required"); + } + // build the list of extensions to try + const extensions = []; + if (ioUtil.IS_WINDOWS && process.env['PATHEXT']) { + for (const extension of process.env['PATHEXT'].split(path.delimiter)) { + if (extension) { + extensions.push(extension); } - return ''; - } - // if any path separators, return empty - if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) { - return ''; } - // build the list of directories - // - // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, - // it feels like we should not do this. Checking the current directory seems like more of a use - // case of a shell, and the which() function exposed by the toolkit should strive for consistency - // across platforms. - const directories = []; - if (process.env.PATH) { - for (const p of process.env.PATH.split(path.delimiter)) { - if (p) { - directories.push(p); - } - } + } + // if it's rooted, return it if exists. otherwise return empty. + if (ioUtil.isRooted(tool)) { + const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions); + if (filePath) { + return [filePath]; } - // return the first match - for (const directory of directories) { - const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions); - if (filePath) { - return filePath; + return []; + } + // if any path separators, return empty + if (tool.includes(path.sep)) { + return []; + } + // build the list of directories + // + // Note, technically "where" checks the current directory on Windows. From a toolkit perspective, + // it feels like we should not do this. Checking the current directory seems like more of a use + // case of a shell, and the which() function exposed by the toolkit should strive for consistency + // across platforms. + const directories = []; + if (process.env.PATH) { + for (const p of process.env.PATH.split(path.delimiter)) { + if (p) { + directories.push(p); } } - return ''; } - catch (err) { - throw new Error(`which failed with message ${err.message}`); + // find all matches + const matches = []; + for (const directory of directories) { + const filePath = yield ioUtil.tryGetExecutablePath(path.join(directory, tool), extensions); + if (filePath) { + matches.push(filePath); + } } + return matches; }); } -exports.which = which; +exports.findInPath = findInPath; function readCopyOptions(options) { const force = options.force == null ? true : options.force; const recursive = Boolean(options.recursive); @@ -1093,7 +1115,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -1264,7 +1286,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -1444,7 +1466,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -1803,7 +1825,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -1904,7 +1926,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -1924,25 +1946,25 @@ const pip3Packages = [ "argcomplete", "colcon-bash==0.4.2", "colcon-cd==0.1.1", - "colcon-cmake==0.2.26", + "colcon-cmake==0.2.19", "colcon-common-extensions==0.2.1", - "colcon-core==0.6.1", + "colcon-core==0.5.6", "colcon-coveragepy-result==0.0.8", - "colcon-defaults==0.2.5", + "colcon-defaults==0.2.4", "colcon-lcov-result==0.5.0", "colcon-library-path==0.2.1", - "colcon-metadata==0.2.5", - "colcon-mixin==0.2.0", - "colcon-notification==0.2.13", - "colcon-output==0.2.12", - "colcon-package-information==0.3.3", - "colcon-package-selection==0.2.10", + "colcon-metadata==0.2.4", + "colcon-mixin==0.1.6", + "colcon-notification==0.2.12", + "colcon-output==0.2.8", + "colcon-package-information==0.3.2", + "colcon-package-selection==0.2.5", "colcon-parallel-executor==0.2.4", "colcon-pkg-config==0.1.0", "colcon-powershell==0.3.6", - "colcon-python-setup-py==0.2.7", + "colcon-python-setup-py==0.2.5", "colcon-recursive-crawl==0.2.1", - "colcon-ros==0.3.21", + "colcon-ros==0.3.17", "colcon-test-result==0.3.8", "coverage", "cryptography", @@ -2033,7 +2055,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -3745,7 +3767,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -4225,7 +4247,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; @@ -5510,11 +5532,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; var _a; Object.defineProperty(exports, "__esModule", { value: true }); const assert_1 = __webpack_require__(357); -const fs = __webpack_require__(747); -const path = __webpack_require__(622); +const fs = __importStar(__webpack_require__(747)); +const path = __importStar(__webpack_require__(622)); _a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink; exports.IS_WINDOWS = process.platform === 'win32'; function exists(fsPath) { @@ -5994,7 +6023,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? ( var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; diff --git a/package-lock.json b/package-lock.json index 58d05b66e..b9a604cc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2853,8 +2853,7 @@ "husky": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/husky/-/husky-6.0.0.tgz", - "integrity": "sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==", - "dev": true + "integrity": "sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==" }, "iconv-lite": { "version": "0.4.24", diff --git a/src/package_manager/pip.ts b/src/package_manager/pip.ts index ed1a83c6c..48db02a4f 100644 --- a/src/package_manager/pip.ts +++ b/src/package_manager/pip.ts @@ -4,25 +4,25 @@ const pip3Packages: string[] = [ "argcomplete", "colcon-bash==0.4.2", "colcon-cd==0.1.1", - "colcon-cmake==0.2.26", + "colcon-cmake==0.2.19", "colcon-common-extensions==0.2.1", - "colcon-core==0.6.1", + "colcon-core==0.5.6", "colcon-coveragepy-result==0.0.8", - "colcon-defaults==0.2.5", + "colcon-defaults==0.2.4", "colcon-lcov-result==0.5.0", "colcon-library-path==0.2.1", - "colcon-metadata==0.2.5", - "colcon-mixin==0.2.0", - "colcon-notification==0.2.13", - "colcon-output==0.2.12", - "colcon-package-information==0.3.3", - "colcon-package-selection==0.2.10", + "colcon-metadata==0.2.4", + "colcon-mixin==0.1.6", + "colcon-notification==0.2.12", + "colcon-output==0.2.8", + "colcon-package-information==0.3.2", + "colcon-package-selection==0.2.5", "colcon-parallel-executor==0.2.4", "colcon-pkg-config==0.1.0", "colcon-powershell==0.3.6", - "colcon-python-setup-py==0.2.7", + "colcon-python-setup-py==0.2.5", "colcon-recursive-crawl==0.2.1", - "colcon-ros==0.3.21", + "colcon-ros==0.3.17", "colcon-test-result==0.3.8", "coverage", "cryptography",