Skip to content

Commit 5d9fdca

Browse files
committed
Handle each OS in its own way
1 parent 7199395 commit 5d9fdca

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

dist/setup/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5325,8 +5325,11 @@ function cacheDependencies(cache, pythonVersion) {
53255325
function run() {
53265326
var _a;
53275327
return __awaiter(this, void 0, void 0, function* () {
5328-
if (!((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim())) {
5329-
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
5328+
if (!utils_1.IS_WINDOWS && !((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim())) {
5329+
if (utils_1.IS_LINUX)
5330+
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
5331+
else
5332+
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
53305333
}
53315334
core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`);
53325335
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];

src/setup-python.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as path from 'path';
55
import * as os from 'os';
66
import fs from 'fs';
77
import {getCacheDistributor} from './cache-distributions/cache-factory';
8-
import {isCacheFeatureAvailable} from './utils';
8+
import {isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS} from './utils';
99

1010
function isPyPyVersion(versionSpec: string) {
1111
return versionSpec.startsWith('pypy');
@@ -49,8 +49,9 @@ function resolveVersionInput(): string {
4949
}
5050

5151
async function run() {
52-
if (!process.env.AGENT_TOOLSDIRECTORY?.trim()) {
53-
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
52+
if (!IS_WINDOWS && !process.env.AGENT_TOOLSDIRECTORY?.trim()) {
53+
if (IS_LINUX) process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
54+
else process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
5455
}
5556
core.debug(
5657
`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`

0 commit comments

Comments
 (0)