mirror of
https://github.com/actions/setup-python.git
synced 2024-11-28 20:05:21 +01: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() {
|
||||
var _a;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// According to the README windows binaries do not require to be installed
|
||||
// in the specific location, but Mac and Linux do
|
||||
if (!utils_1.IS_WINDOWS && !((_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';
|
||||
// When setting AGENT_TOOLSDIRECTORY, the actions/tool-cache function find
|
||||
// is not able to find the files cached by actions/python-version.
|
||||
if ((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) {
|
||||
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']}`);
|
||||
|
|
|
@ -7,9 +7,7 @@ import fs from 'fs';
|
|||
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
||||
import {
|
||||
isCacheFeatureAvailable,
|
||||
logWarning,
|
||||
IS_LINUX,
|
||||
IS_WINDOWS
|
||||
logWarning
|
||||
} from './utils';
|
||||
|
||||
function isPyPyVersion(versionSpec: string) {
|
||||
|
@ -68,11 +66,9 @@ function resolveVersionInput(): string {
|
|||
}
|
||||
|
||||
async function run() {
|
||||
// According to the README windows binaries do not require to be installed
|
||||
// in the specific location, but Mac and Linux do
|
||||
if (!IS_WINDOWS && !process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||
if (IS_LINUX) process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
|
||||
else process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
||||
// When setting AGENT_TOOLSDIRECTORY, the actions/tool-cache function find
|
||||
// is not able to find the files cached by actions/python-version.
|
||||
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
||||
}
|
||||
core.debug(
|
||||
|
|
Loading…
Reference in a new issue