mirror of
				https://gitea.com/actions/setup-python.git
				synced 2025-10-29 07:47:14 +00:00 
			
		
		
		
	Initial pass
This commit is contained in:
		
							
								
								
									
										49
									
								
								node_modules/@actions/io/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								node_modules/@actions/io/README.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| # `@actions/io` | ||||
|  | ||||
| > Core functions for cli filesystem scenarios | ||||
|  | ||||
| ## Usage | ||||
|  | ||||
| ``` | ||||
| /** | ||||
|  * Copies a file or folder. | ||||
|  *  | ||||
|  * @param     source    source path | ||||
|  * @param     dest      destination path | ||||
|  * @param     options   optional. See CopyOptions. | ||||
|  */ | ||||
| export function cp(source: string, dest: string, options?: CopyOptions): Promise<void> | ||||
|  | ||||
| /** | ||||
|  * Remove a path recursively with force | ||||
|  *  | ||||
|  * @param     path     path to remove | ||||
|  */ | ||||
| export function rmRF(path: string): Promise<void> | ||||
|  | ||||
| /** | ||||
|  * Make a directory.  Creates the full path with folders in between | ||||
|  *  | ||||
|  * @param     p       path to create | ||||
|  * @returns   Promise<void> | ||||
|  */ | ||||
| export function mkdirP(p: string): Promise<void> | ||||
|  | ||||
| /** | ||||
|  * Moves a path. | ||||
|  * | ||||
|  * @param     source    source path | ||||
|  * @param     dest      destination path | ||||
|  * @param     options   optional. See CopyOptions. | ||||
|  */ | ||||
| export function mv(source: string, dest: string, options?: CopyOptions): Promise<void> | ||||
|  | ||||
| /** | ||||
|  * Returns path of a tool had the tool actually been invoked.  Resolves via paths. | ||||
|  *  | ||||
|  * @param     tool              name of the tool | ||||
|  * @param     options           optional. See WhichOptions. | ||||
|  * @returns   Promise<string>   path to tool | ||||
|  */ | ||||
| export function which(tool: string, options?: WhichOptions): Promise<string> | ||||
| ``` | ||||
							
								
								
									
										29
									
								
								node_modules/@actions/io/lib/io-util.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								node_modules/@actions/io/lib/io-util.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| /// <reference types="node" /> | ||||
| import * as fs from 'fs'; | ||||
| export declare const copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, unlink: typeof fs.promises.unlink; | ||||
| export declare const IS_WINDOWS: boolean; | ||||
| export declare function exists(fsPath: string): Promise<boolean>; | ||||
| export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>; | ||||
| /** | ||||
|  * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: | ||||
|  * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). | ||||
|  */ | ||||
| export declare function isRooted(p: string): boolean; | ||||
| /** | ||||
|  * Recursively create a directory at `fsPath`. | ||||
|  * | ||||
|  * This implementation is optimistic, meaning it attempts to create the full | ||||
|  * path first, and backs up the path stack from there. | ||||
|  * | ||||
|  * @param fsPath The path to create | ||||
|  * @param maxDepth The maximum recursion depth | ||||
|  * @param depth The current recursion depth | ||||
|  */ | ||||
| export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>; | ||||
| /** | ||||
|  * Best effort attempt to determine whether a file exists and is executable. | ||||
|  * @param filePath    file path to check | ||||
|  * @param extensions  additional file extensions to try | ||||
|  * @return if file exists and is executable, returns the file path. otherwise empty string. | ||||
|  */ | ||||
| export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>; | ||||
							
								
								
									
										194
									
								
								node_modules/@actions/io/lib/io-util.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										194
									
								
								node_modules/@actions/io/lib/io-util.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,194 @@ | ||||
| "use strict"; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| var _a; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const assert_1 = require("assert"); | ||||
| const fs = require("fs"); | ||||
| const path = require("path"); | ||||
| _a = fs.promises, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.unlink = _a.unlink; | ||||
| exports.IS_WINDOWS = process.platform === 'win32'; | ||||
| function exists(fsPath) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         try { | ||||
|             yield exports.stat(fsPath); | ||||
|         } | ||||
|         catch (err) { | ||||
|             if (err.code === 'ENOENT') { | ||||
|                 return false; | ||||
|             } | ||||
|             throw err; | ||||
|         } | ||||
|         return true; | ||||
|     }); | ||||
| } | ||||
| exports.exists = exists; | ||||
| function isDirectory(fsPath, useStat = false) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath); | ||||
|         return stats.isDirectory(); | ||||
|     }); | ||||
| } | ||||
| exports.isDirectory = isDirectory; | ||||
| /** | ||||
|  * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like: | ||||
|  * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases). | ||||
|  */ | ||||
| function isRooted(p) { | ||||
|     p = normalizeSeparators(p); | ||||
|     if (!p) { | ||||
|         throw new Error('isRooted() parameter "p" cannot be empty'); | ||||
|     } | ||||
|     if (exports.IS_WINDOWS) { | ||||
|         return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello | ||||
|         ); // e.g. C: or C:\hello | ||||
|     } | ||||
|     return p.startsWith('/'); | ||||
| } | ||||
| exports.isRooted = isRooted; | ||||
| /** | ||||
|  * Recursively create a directory at `fsPath`. | ||||
|  * | ||||
|  * This implementation is optimistic, meaning it attempts to create the full | ||||
|  * path first, and backs up the path stack from there. | ||||
|  * | ||||
|  * @param fsPath The path to create | ||||
|  * @param maxDepth The maximum recursion depth | ||||
|  * @param depth The current recursion depth | ||||
|  */ | ||||
| function mkdirP(fsPath, maxDepth = 1000, depth = 1) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         assert_1.ok(fsPath, 'a path argument must be provided'); | ||||
|         fsPath = path.resolve(fsPath); | ||||
|         if (depth >= maxDepth) | ||||
|             return exports.mkdir(fsPath); | ||||
|         try { | ||||
|             yield exports.mkdir(fsPath); | ||||
|             return; | ||||
|         } | ||||
|         catch (err) { | ||||
|             switch (err.code) { | ||||
|                 case 'ENOENT': { | ||||
|                     yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1); | ||||
|                     yield exports.mkdir(fsPath); | ||||
|                     return; | ||||
|                 } | ||||
|                 default: { | ||||
|                     let stats; | ||||
|                     try { | ||||
|                         stats = yield exports.stat(fsPath); | ||||
|                     } | ||||
|                     catch (err2) { | ||||
|                         throw err; | ||||
|                     } | ||||
|                     if (!stats.isDirectory()) | ||||
|                         throw err; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| exports.mkdirP = mkdirP; | ||||
| /** | ||||
|  * Best effort attempt to determine whether a file exists and is executable. | ||||
|  * @param filePath    file path to check | ||||
|  * @param extensions  additional file extensions to try | ||||
|  * @return if file exists and is executable, returns the file path. otherwise empty string. | ||||
|  */ | ||||
| function tryGetExecutablePath(filePath, extensions) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         let stats = undefined; | ||||
|         try { | ||||
|             // test file exists | ||||
|             stats = yield exports.stat(filePath); | ||||
|         } | ||||
|         catch (err) { | ||||
|             if (err.code !== 'ENOENT') { | ||||
|                 // eslint-disable-next-line no-console | ||||
|                 console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); | ||||
|             } | ||||
|         } | ||||
|         if (stats && stats.isFile()) { | ||||
|             if (exports.IS_WINDOWS) { | ||||
|                 // on Windows, test for valid extension | ||||
|                 const upperExt = path.extname(filePath).toUpperCase(); | ||||
|                 if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) { | ||||
|                     return filePath; | ||||
|                 } | ||||
|             } | ||||
|             else { | ||||
|                 if (isUnixExecutable(stats)) { | ||||
|                     return filePath; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         // try each extension | ||||
|         const originalFilePath = filePath; | ||||
|         for (const extension of extensions) { | ||||
|             filePath = originalFilePath + extension; | ||||
|             stats = undefined; | ||||
|             try { | ||||
|                 stats = yield exports.stat(filePath); | ||||
|             } | ||||
|             catch (err) { | ||||
|                 if (err.code !== 'ENOENT') { | ||||
|                     // eslint-disable-next-line no-console | ||||
|                     console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`); | ||||
|                 } | ||||
|             } | ||||
|             if (stats && stats.isFile()) { | ||||
|                 if (exports.IS_WINDOWS) { | ||||
|                     // preserve the case of the actual file (since an extension was appended) | ||||
|                     try { | ||||
|                         const directory = path.dirname(filePath); | ||||
|                         const upperName = path.basename(filePath).toUpperCase(); | ||||
|                         for (const actualName of yield exports.readdir(directory)) { | ||||
|                             if (upperName === actualName.toUpperCase()) { | ||||
|                                 filePath = path.join(directory, actualName); | ||||
|                                 break; | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|                     catch (err) { | ||||
|                         // eslint-disable-next-line no-console | ||||
|                         console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`); | ||||
|                     } | ||||
|                     return filePath; | ||||
|                 } | ||||
|                 else { | ||||
|                     if (isUnixExecutable(stats)) { | ||||
|                         return filePath; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return ''; | ||||
|     }); | ||||
| } | ||||
| exports.tryGetExecutablePath = tryGetExecutablePath; | ||||
| function normalizeSeparators(p) { | ||||
|     p = p || ''; | ||||
|     if (exports.IS_WINDOWS) { | ||||
|         // convert slashes on Windows | ||||
|         p = p.replace(/\//g, '\\'); | ||||
|         // remove redundant slashes | ||||
|         return p.replace(/\\\\+/g, '\\'); | ||||
|     } | ||||
|     // remove redundant slashes | ||||
|     return p.replace(/\/\/+/g, '/'); | ||||
| } | ||||
| // on Mac/Linux, test the execute bit | ||||
| //     R   W  X  R  W X R W X | ||||
| //   256 128 64 32 16 8 4 2 1 | ||||
| function isUnixExecutable(stats) { | ||||
|     return ((stats.mode & 1) > 0 || | ||||
|         ((stats.mode & 8) > 0 && stats.gid === process.getgid()) || | ||||
|         ((stats.mode & 64) > 0 && stats.uid === process.getuid())); | ||||
| } | ||||
| //# sourceMappingURL=io-util.js.map | ||||
							
								
								
									
										1
									
								
								node_modules/@actions/io/lib/io-util.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/@actions/io/lib/io-util.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAQE,iMAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,G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ChB;iBACF;aACF;SACF;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA5ED,oDA4EC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"} | ||||
							
								
								
									
										48
									
								
								node_modules/@actions/io/lib/io.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								node_modules/@actions/io/lib/io.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| /** | ||||
|  * Interface for cp/mv options | ||||
|  */ | ||||
| export interface CopyOptions { | ||||
|     /** Optional. Whether to recursively copy all subdirectories. Defaults to false */ | ||||
|     recursive?: boolean; | ||||
|     /** Optional. Whether to overwrite existing files in the destination. Defaults to true */ | ||||
|     force?: boolean; | ||||
| } | ||||
| /** | ||||
|  * Copies a file or folder. | ||||
|  * | ||||
|  * @param     source    source path | ||||
|  * @param     dest      destination path | ||||
|  * @param     options   optional. See CopyOptions. | ||||
|  */ | ||||
| export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>; | ||||
| /** | ||||
|  * Moves a path. | ||||
|  * | ||||
|  * @param     source    source path | ||||
|  * @param     dest      destination path | ||||
|  * @param     options   optional. See CopyOptions. | ||||
|  */ | ||||
| export declare function mv(source: string, dest: string, options?: CopyOptions): Promise<void>; | ||||
| /** | ||||
|  * Remove a path recursively with force | ||||
|  * | ||||
|  * @param inputPath path to remove | ||||
|  */ | ||||
| export declare function rmRF(inputPath: string): Promise<void>; | ||||
| /** | ||||
|  * Make a directory.  Creates the full path with folders in between | ||||
|  * Will throw if it fails | ||||
|  * | ||||
|  * @param   fsPath        path to create | ||||
|  * @returns Promise<void> | ||||
|  */ | ||||
| export declare function mkdirP(fsPath: string): Promise<void>; | ||||
| /** | ||||
|  * Returns path of a tool had the tool actually been invoked.  Resolves via paths. | ||||
|  * If you check and the tool does not exist, it will throw. | ||||
|  * | ||||
|  * @param     tool              name of the tool | ||||
|  * @param     check             whether to check if tool exists | ||||
|  * @returns   Promise<string>   path to tool | ||||
|  */ | ||||
| export declare function which(tool: string, check?: boolean): Promise<string>; | ||||
							
								
								
									
										262
									
								
								node_modules/@actions/io/lib/io.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										262
									
								
								node_modules/@actions/io/lib/io.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,262 @@ | ||||
| "use strict"; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| const childProcess = require("child_process"); | ||||
| const fs = require("fs"); | ||||
| const path = require("path"); | ||||
| const util_1 = require("util"); | ||||
| const ioUtil = require("./io-util"); | ||||
| const exec = util_1.promisify(childProcess.exec); | ||||
| /** | ||||
|  * Copies a file or folder. | ||||
|  * | ||||
|  * @param     source    source path | ||||
|  * @param     dest      destination path | ||||
|  * @param     options   optional. See CopyOptions. | ||||
|  */ | ||||
| function cp(source, dest, options = {}) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         yield move(source, dest, options, { deleteOriginal: false }); | ||||
|     }); | ||||
| } | ||||
| exports.cp = cp; | ||||
| /** | ||||
|  * Moves a path. | ||||
|  * | ||||
|  * @param     source    source path | ||||
|  * @param     dest      destination path | ||||
|  * @param     options   optional. See CopyOptions. | ||||
|  */ | ||||
| function mv(source, dest, options = {}) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         yield move(source, dest, options, { deleteOriginal: true }); | ||||
|     }); | ||||
| } | ||||
| exports.mv = mv; | ||||
| /** | ||||
|  * Remove a path recursively with force | ||||
|  * | ||||
|  * @param inputPath path to remove | ||||
|  */ | ||||
| function rmRF(inputPath) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         if (ioUtil.IS_WINDOWS) { | ||||
|             // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another | ||||
|             // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del. | ||||
|             try { | ||||
|                 if (yield ioUtil.isDirectory(inputPath, true)) { | ||||
|                     yield exec(`rd /s /q "${inputPath}"`); | ||||
|                 } | ||||
|                 else { | ||||
|                     yield exec(`del /f /a "${inputPath}"`); | ||||
|                 } | ||||
|             } | ||||
|             catch (err) { | ||||
|                 // if you try to delete a file that doesn't exist, desired result is achieved | ||||
|                 // other errors are valid | ||||
|                 if (err.code !== 'ENOENT') | ||||
|                     throw err; | ||||
|             } | ||||
|             // Shelling out fails to remove a symlink folder with missing source, this unlink catches that | ||||
|             try { | ||||
|                 yield ioUtil.unlink(inputPath); | ||||
|             } | ||||
|             catch (err) { | ||||
|                 // if you try to delete a file that doesn't exist, desired result is achieved | ||||
|                 // other errors are valid | ||||
|                 if (err.code !== 'ENOENT') | ||||
|                     throw err; | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|             let isDir = false; | ||||
|             try { | ||||
|                 isDir = yield ioUtil.isDirectory(inputPath); | ||||
|             } | ||||
|             catch (err) { | ||||
|                 // if you try to delete a file that doesn't exist, desired result is achieved | ||||
|                 // other errors are valid | ||||
|                 if (err.code !== 'ENOENT') | ||||
|                     throw err; | ||||
|                 return; | ||||
|             } | ||||
|             if (isDir) { | ||||
|                 yield exec(`rm -rf "${inputPath}"`); | ||||
|             } | ||||
|             else { | ||||
|                 yield ioUtil.unlink(inputPath); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| exports.rmRF = rmRF; | ||||
| /** | ||||
|  * Make a directory.  Creates the full path with folders in between | ||||
|  * Will throw if it fails | ||||
|  * | ||||
|  * @param   fsPath        path to create | ||||
|  * @returns Promise<void> | ||||
|  */ | ||||
| function mkdirP(fsPath) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         yield ioUtil.mkdirP(fsPath); | ||||
|     }); | ||||
| } | ||||
| exports.mkdirP = mkdirP; | ||||
| /** | ||||
|  * Returns path of a tool had the tool actually been invoked.  Resolves via paths. | ||||
|  * If you check and the tool does not exist, it will throw. | ||||
|  * | ||||
|  * @param     tool              name of the tool | ||||
|  * @param     check             whether to check if tool exists | ||||
|  * @returns   Promise<string>   path to tool | ||||
|  */ | ||||
| function which(tool, check) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         if (!tool) { | ||||
|             throw new Error("parameter 'tool' is required"); | ||||
|         } | ||||
|         // recursive when check=true | ||||
|         if (check) { | ||||
|             const result = yield which(tool, false); | ||||
|             if (!result) { | ||||
|                 if (ioUtil.IS_WINDOWS) { | ||||
|                     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 verify the file has a valid extension for an executable file.`); | ||||
|                 } | ||||
|                 else { | ||||
|                     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.`); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         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; | ||||
|                 } | ||||
|                 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 task lib 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 task lib 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 the first match | ||||
|             for (const directory of directories) { | ||||
|                 const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions); | ||||
|                 if (filePath) { | ||||
|                     return filePath; | ||||
|                 } | ||||
|             } | ||||
|             return ''; | ||||
|         } | ||||
|         catch (err) { | ||||
|             throw new Error(`which failed with message ${err.message}`); | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| exports.which = which; | ||||
| // Copies contents of source into dest, making any necessary folders along the way. | ||||
| // Deletes the original copy if deleteOriginal is true | ||||
| function copyDirectoryContents(source, dest, force, deleteOriginal = false) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         if (yield ioUtil.isDirectory(source)) { | ||||
|             if (yield ioUtil.exists(dest)) { | ||||
|                 if (!(yield ioUtil.isDirectory(dest))) { | ||||
|                     throw new Error(`${dest} is not a directory`); | ||||
|                 } | ||||
|             } | ||||
|             else { | ||||
|                 yield mkdirP(dest); | ||||
|             } | ||||
|             // Copy all child files, and directories recursively | ||||
|             const sourceChildren = yield ioUtil.readdir(source); | ||||
|             for (const newSource of sourceChildren) { | ||||
|                 const newDest = path.join(dest, path.basename(newSource)); | ||||
|                 yield copyDirectoryContents(path.resolve(source, newSource), newDest, force, deleteOriginal); | ||||
|             } | ||||
|             if (deleteOriginal) { | ||||
|                 yield ioUtil.rmdir(source); | ||||
|             } | ||||
|         } | ||||
|         else { | ||||
|             if (force) { | ||||
|                 yield ioUtil.copyFile(source, dest); | ||||
|             } | ||||
|             else { | ||||
|                 yield ioUtil.copyFile(source, dest, fs.constants.COPYFILE_EXCL); | ||||
|             } | ||||
|             if (deleteOriginal) { | ||||
|                 yield ioUtil.unlink(source); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| function move(source, dest, options = {}, moveOptions) { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         const { force, recursive } = readCopyOptions(options); | ||||
|         if (yield ioUtil.isDirectory(source)) { | ||||
|             if (!recursive) { | ||||
|                 throw new Error(`non-recursive cp failed, ${source} is a directory`); | ||||
|             } | ||||
|             // If directory exists, move source inside it. Otherwise, create it and move contents of source inside. | ||||
|             if (yield ioUtil.exists(dest)) { | ||||
|                 if (!(yield ioUtil.isDirectory(dest))) { | ||||
|                     throw new Error(`${dest} is not a directory`); | ||||
|                 } | ||||
|                 dest = path.join(dest, path.basename(source)); | ||||
|             } | ||||
|             yield copyDirectoryContents(source, dest, force, moveOptions.deleteOriginal); | ||||
|         } | ||||
|         else { | ||||
|             if ((yield ioUtil.exists(dest)) && (yield ioUtil.isDirectory(dest))) { | ||||
|                 dest = path.join(dest, path.basename(source)); | ||||
|             } | ||||
|             if (force) { | ||||
|                 yield ioUtil.copyFile(source, dest); | ||||
|             } | ||||
|             else { | ||||
|                 yield ioUtil.copyFile(source, dest, fs.constants.COPYFILE_EXCL); | ||||
|             } | ||||
|             if (moveOptions.deleteOriginal) { | ||||
|                 yield ioUtil.unlink(source); | ||||
|             } | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| function readCopyOptions(options) { | ||||
|     const force = options.force == null ? true : options.force; | ||||
|     const recursive = Boolean(options.recursive); | ||||
|     return { force, recursive }; | ||||
| } | ||||
| //# sourceMappingURL=io.js.map | ||||
							
								
								
									
										1
									
								
								node_modules/@actions/io/lib/io.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								node_modules/@actions/io/lib/io.js.map
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										60
									
								
								node_modules/@actions/io/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								node_modules/@actions/io/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| { | ||||
|   "_from": "file:toolkit\\actions-io-0.0.0.tgz", | ||||
|   "_id": "@actions/io@0.0.0", | ||||
|   "_inBundle": false, | ||||
|   "_integrity": "sha512-BArfobXB/b6RjR4i/+P4UcdaqR2tPjEb2WzZf9GdKiSARQn7d301pKOZAqxA+0N11X07Lk46t/txeUBcrCNbeg==", | ||||
|   "_location": "/@actions/io", | ||||
|   "_phantomChildren": {}, | ||||
|   "_requested": { | ||||
|     "type": "file", | ||||
|     "where": "C:\\Users\\damccorm\\Documents\\setup-node", | ||||
|     "raw": "@actions/io@file:toolkit/actions-io-0.0.0.tgz", | ||||
|     "name": "@actions/io", | ||||
|     "escapedName": "@actions%2fio", | ||||
|     "scope": "@actions", | ||||
|     "rawSpec": "file:toolkit/actions-io-0.0.0.tgz", | ||||
|     "saveSpec": "file:toolkit\\actions-io-0.0.0.tgz", | ||||
|     "fetchSpec": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz" | ||||
|   }, | ||||
|   "_requiredBy": [ | ||||
|     "/", | ||||
|     "/@actions/tool-cache" | ||||
|   ], | ||||
|   "_resolved": "C:\\Users\\damccorm\\Documents\\setup-node\\toolkit\\actions-io-0.0.0.tgz", | ||||
|   "_shasum": "1e8f0faca6b39215bebacedf473e5bb0716e39bf", | ||||
|   "_spec": "@actions/io@file:toolkit/actions-io-0.0.0.tgz", | ||||
|   "_where": "C:\\Users\\damccorm\\Documents\\setup-node", | ||||
|   "bugs": { | ||||
|     "url": "https://github.com/actions/toolkit/issues" | ||||
|   }, | ||||
|   "bundleDependencies": false, | ||||
|   "deprecated": false, | ||||
|   "description": "Actions io lib", | ||||
|   "directories": { | ||||
|     "lib": "lib", | ||||
|     "test": "__tests__" | ||||
|   }, | ||||
|   "files": [ | ||||
|     "lib" | ||||
|   ], | ||||
|   "homepage": "https://github.com/actions/toolkit/tree/master/packages/io", | ||||
|   "keywords": [ | ||||
|     "io", | ||||
|     "actions" | ||||
|   ], | ||||
|   "license": "MIT", | ||||
|   "main": "lib/io.js", | ||||
|   "name": "@actions/io", | ||||
|   "publishConfig": { | ||||
|     "access": "public" | ||||
|   }, | ||||
|   "repository": { | ||||
|     "type": "git", | ||||
|     "url": "git+https://github.com/actions/toolkit.git" | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "test": "echo \"Error: run tests from root\" && exit 1", | ||||
|     "tsc": "tsc" | ||||
|   }, | ||||
|   "version": "0.0.0" | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Danny McCormick
					Danny McCormick