From 501a62ec41d061794ac091a9dca55eb481ad30d7 Mon Sep 17 00:00:00 2001 From: Leon Wright Date: Fri, 22 Jul 2022 16:03:42 +0800 Subject: [PATCH] fix: Complain loudly, but don't override mac toolpath --- dist/setup/index.js | 8 ++++++-- src/setup-python.ts | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 21ede59d4..0b2ffc8af 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -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(); diff --git a/src/setup-python.ts b/src/setup-python.ts index a76ba38f2..3252213f0 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -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']}`