mirror of
https://github.com/actions/setup-python.git
synced 2024-11-25 00:20:58 -05:00
fix: Self-Hosted Tool Cache
This fixes the tool cache path for self-hosted runners, along with handling AGENT_TOOLSDIRECTORY for both hosted + self-hosted. Fixes actions#459
This commit is contained in:
parent
10b840936c
commit
9f1915a970
2 changed files with 7 additions and 15 deletions
10
dist/setup/index.js
vendored
10
dist/setup/index.js
vendored
|
@ -65340,13 +65340,9 @@ function resolveVersionInput() {
|
||||||
function run() {
|
function run() {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// According to the README windows binaries do not require to be installed
|
// When setting AGENT_TOOLSDIRECTORY, the actions/tool-cache function find
|
||||||
// in the specific location, but Mac and Linux do
|
// is not able to find the files cached by actions/python-version.
|
||||||
if (!utils_1.IS_WINDOWS && !((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim())) {
|
if ((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) {
|
||||||
if (utils_1.IS_LINUX)
|
|
||||||
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
|
|
||||||
else
|
|
||||||
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
||||||
}
|
}
|
||||||
core.debug(`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`);
|
core.debug(`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`);
|
||||||
|
|
|
@ -7,9 +7,7 @@ import fs from 'fs';
|
||||||
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
||||||
import {
|
import {
|
||||||
isCacheFeatureAvailable,
|
isCacheFeatureAvailable,
|
||||||
logWarning,
|
logWarning
|
||||||
IS_LINUX,
|
|
||||||
IS_WINDOWS
|
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
function isPyPyVersion(versionSpec: string) {
|
function isPyPyVersion(versionSpec: string) {
|
||||||
|
@ -68,11 +66,9 @@ function resolveVersionInput(): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
// According to the README windows binaries do not require to be installed
|
// When setting AGENT_TOOLSDIRECTORY, the actions/tool-cache function find
|
||||||
// in the specific location, but Mac and Linux do
|
// is not able to find the files cached by actions/python-version.
|
||||||
if (!IS_WINDOWS && !process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||||
if (IS_LINUX) process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
|
|
||||||
else process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
|
||||||
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
||||||
}
|
}
|
||||||
core.debug(
|
core.debug(
|
||||||
|
|
Loading…
Reference in a new issue