Skip to content

Commit

Permalink
Handle each OS in its own way
Browse files Browse the repository at this point in the history
  • Loading branch information
dsame committed Jun 29, 2022
1 parent 7199395 commit 5d9fdca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5325,8 +5325,11 @@ function cacheDependencies(cache, pythonVersion) {
function run() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
if (!((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim())) {
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
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';
}
core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`);
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
Expand Down
7 changes: 4 additions & 3 deletions src/setup-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as path from 'path';
import * as os from 'os';
import fs from 'fs';
import {getCacheDistributor} from './cache-distributions/cache-factory';
import {isCacheFeatureAvailable} from './utils';
import {isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS} from './utils';

function isPyPyVersion(versionSpec: string) {
return versionSpec.startsWith('pypy');
Expand Down Expand Up @@ -49,8 +49,9 @@ function resolveVersionInput(): string {
}

async function run() {
if (!process.env.AGENT_TOOLSDIRECTORY?.trim()) {
process.env['AGENT_TOOLSDIRECTORY'] = '/opt/hostedtoolcache';
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';
}
core.debug(
`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env['AGENT_TOOLSDIRECTORY']}`
Expand Down

0 comments on commit 5d9fdca

Please sign in to comment.