mirror of
https://code.forgejo.org/actions/setup-python
synced 2025-03-14 22:26:58 +01:00
Merge 91b95c4e89
into 9e62be81b2
This commit is contained in:
commit
7137cef5d5
2 changed files with 25 additions and 18 deletions
22
dist/setup/index.js
vendored
22
dist/setup/index.js
vendored
|
@ -98893,24 +98893,28 @@ class PipCache extends cache_distributor_1.default {
|
|||
}
|
||||
getCacheGlobalDirectories() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let exitCode = 1;
|
||||
let exitCode = 0;
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
// Add temporary fix for Windows
|
||||
// On windows it is necessary to execute through an exec
|
||||
// because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2,
|
||||
// On Windows, it is necessary to execute through an exec
|
||||
// because the getExecOutput gives a non-zero code or writes to stderr for pip 22.0.2,
|
||||
// or spawn must be started with the shell option enabled for getExecOutput
|
||||
// Related issue: https://github.com/actions/setup-python/issues/328
|
||||
if (utils_1.IS_WINDOWS) {
|
||||
const execPromisify = util_1.default.promisify(child_process.exec);
|
||||
({ stdout: stdout, stderr: stderr } = yield execPromisify('pip cache dir'));
|
||||
try {
|
||||
({ stdout, stderr } = yield execPromisify('pip cache dir'));
|
||||
}
|
||||
catch (err) {
|
||||
// Pip outputs warnings to stderr (e.g., --no-python-version-warning flag deprecation warning), causing false failure detection
|
||||
// Related issue: https://github.com/actions/setup-python/issues/1034
|
||||
// If an error occurs, set exitCode to 1 to indicate failure
|
||||
exitCode = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
({
|
||||
stdout: stdout,
|
||||
stderr: stderr,
|
||||
exitCode: exitCode
|
||||
} = yield exec.getExecOutput('pip cache dir'));
|
||||
({ stdout, stderr, exitCode } = yield exec.getExecOutput('pip cache dir'));
|
||||
}
|
||||
if (exitCode && stderr) {
|
||||
throw new Error(`Could not get cache folder path for pip package manager`);
|
||||
|
|
|
@ -21,24 +21,27 @@ class PipCache extends CacheDistributor {
|
|||
}
|
||||
|
||||
protected async getCacheGlobalDirectories() {
|
||||
let exitCode = 1;
|
||||
let exitCode = 0;
|
||||
let stdout = '';
|
||||
let stderr = '';
|
||||
|
||||
// Add temporary fix for Windows
|
||||
// On windows it is necessary to execute through an exec
|
||||
// because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2,
|
||||
// On Windows, it is necessary to execute through an exec
|
||||
// because the getExecOutput gives a non-zero code or writes to stderr for pip 22.0.2,
|
||||
// or spawn must be started with the shell option enabled for getExecOutput
|
||||
// Related issue: https://github.com/actions/setup-python/issues/328
|
||||
if (IS_WINDOWS) {
|
||||
const execPromisify = utils.promisify(child_process.exec);
|
||||
({stdout: stdout, stderr: stderr} = await execPromisify('pip cache dir'));
|
||||
try {
|
||||
({stdout, stderr} = await execPromisify('pip cache dir'));
|
||||
} catch (err) {
|
||||
// Pip outputs warnings to stderr (e.g., --no-python-version-warning flag deprecation warning), causing false failure detection
|
||||
// Related issue: https://github.com/actions/setup-python/issues/1034
|
||||
// If an error occurs, set exitCode to 1 to indicate failure
|
||||
exitCode = 1;
|
||||
}
|
||||
} else {
|
||||
({
|
||||
stdout: stdout,
|
||||
stderr: stderr,
|
||||
exitCode: exitCode
|
||||
} = await exec.getExecOutput('pip cache dir'));
|
||||
({stdout, stderr, exitCode} = await exec.getExecOutput('pip cache dir'));
|
||||
}
|
||||
|
||||
if (exitCode && stderr) {
|
||||
|
|
Loading…
Add table
Reference in a new issue