From 1905a0390ca5d31b0ecd646d3c3d33553d6e1a58 Mon Sep 17 00:00:00 2001 From: Leon Wright Date: Sat, 23 Jul 2022 10:06:39 +0800 Subject: [PATCH] Update src/setup-python.ts Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com> --- src/setup-python.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/setup-python.ts b/src/setup-python.ts index 3252213f0..69d8125bf 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -61,15 +61,21 @@ 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() && !IS_MAC) { + if (!process.env.AGENT_TOOLSDIRECTORY?.trim() && IS_MAC) { + process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache'; + } + + if (process.env.AGENT_TOOLSDIRECTORY?.trim()){ 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 ${ + process.env.AGENT_TOOLSDIRECTORY?.trim() + ? process.env['AGENT_TOOLSDIRECTORY'] + : process.env['RUNNER_TOOL_CACHE'] + }` + ); } core.debug( `Python is expected to be installed into RUNNER_TOOL_CACHE=${process.env['RUNNER_TOOL_CACHE']}`