Skip to content

Commit

Permalink
fix: Complain loudly, but don't override mac toolpath
Browse files Browse the repository at this point in the history
  • Loading branch information
techman83 committed Jul 22, 2022
1 parent 9a97479 commit 501a62e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions dist/setup/index.js
Expand Up @@ -65276,13 +65276,17 @@ function resolveVersionInput() {
return version;
}
function run() {
var _a;
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
// 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()) {
if (((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) && !utils_1.IS_MAC) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
}
else if (((_b = process.env.AGENT_TOOLSDIRECTORY) === null || _b === void 0 ? void 0 : _b.trim()) && utils_1.IS_MAC) {
process.env['AGENT_TOOLSDIRECTORY'] = process.env['RUNNER_TOOL_CACHE'];
core.warning('AGENT_TOOLSDIRECTORY is not valid for MacOS as shared libraries are configured with a fixed path.');
}
core.debug(`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`);
try {
const version = resolveVersionInput();
Expand Down
7 changes: 6 additions & 1 deletion src/setup-python.ts
Expand Up @@ -63,8 +63,13 @@ function resolveVersionInput(): string {
async function run() {
// 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()) {
if (process.env.AGENT_TOOLSDIRECTORY?.trim() && !IS_MAC) {
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
} else if (process.env.AGENT_TOOLSDIRECTORY?.trim() && IS_MAC) {
process.env['AGENT_TOOLSDIRECTORY'] = process.env['RUNNER_TOOL_CACHE'];
core.warning(
'AGENT_TOOLSDIRECTORY is not valid for MacOS as shared libraries are configured with a fixed path.'
);
}
core.debug(
`Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`
Expand Down

0 comments on commit 501a62e

Please sign in to comment.