mirror of
https://github.com/actions/setup-python.git
synced 2025-04-20 03:53:30 +00:00
fix: don't override AGENT_TOOLSDIRECTORY
if it's not needed
`AGENT_TOOLSDIRECTORY` is always overriden on macOS. This seems to be needed because CPython < 3.11 x64 builds are not relocatable. It means this is not needed for PyPy and also not needed when targetting macOS arm64 runners.
This commit is contained in:
parent
2c3dd9e7e2
commit
21aa270b17
20
dist/setup/index.js
vendored
20
dist/setup/index.js
vendored
@ -66896,21 +66896,23 @@ function resolveVersionInput() {
|
|||||||
function run() {
|
function run() {
|
||||||
var _a;
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (utils_1.IS_MAC) {
|
try {
|
||||||
|
const version = resolveVersionInput();
|
||||||
|
if (version) {
|
||||||
|
let pythonVersion;
|
||||||
|
const arch = core.getInput('architecture') || os.arch();
|
||||||
|
const updateEnvironment = core.getBooleanInput('update-environment');
|
||||||
|
const checkLatest = core.getBooleanInput('check-latest');
|
||||||
|
const isPyPy = isPyPyVersion(version);
|
||||||
|
const forceMacToolsDirectory = utils_1.IS_MAC && !isPyPy && arch === 'x64';
|
||||||
|
if (forceMacToolsDirectory) {
|
||||||
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
||||||
}
|
}
|
||||||
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()) {
|
||||||
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
||||||
}
|
}
|
||||||
core.debug(`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`);
|
core.debug(`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`);
|
||||||
try {
|
if (isPyPy) {
|
||||||
const version = resolveVersionInput();
|
|
||||||
const checkLatest = core.getBooleanInput('check-latest');
|
|
||||||
if (version) {
|
|
||||||
let pythonVersion;
|
|
||||||
const arch = core.getInput('architecture') || os.arch();
|
|
||||||
const updateEnvironment = core.getBooleanInput('update-environment');
|
|
||||||
if (isPyPyVersion(version)) {
|
|
||||||
const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest);
|
const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest);
|
||||||
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
|
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
|
||||||
core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
|
core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
|
||||||
|
@ -63,7 +63,18 @@ function resolveVersionInput(): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
if (IS_MAC) {
|
try {
|
||||||
|
const version = resolveVersionInput();
|
||||||
|
|
||||||
|
if (version) {
|
||||||
|
let pythonVersion: string;
|
||||||
|
const arch: string = core.getInput('architecture') || os.arch();
|
||||||
|
const updateEnvironment = core.getBooleanInput('update-environment');
|
||||||
|
const checkLatest = core.getBooleanInput('check-latest');
|
||||||
|
const isPyPy = isPyPyVersion(version);
|
||||||
|
const forceMacToolsDirectory = IS_MAC && !isPyPy && arch === 'x64';
|
||||||
|
|
||||||
|
if (forceMacToolsDirectory) {
|
||||||
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
process.env['AGENT_TOOLSDIRECTORY'] = '/Users/runner/hostedtoolcache';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,15 +85,8 @@ async function run() {
|
|||||||
core.debug(
|
core.debug(
|
||||||
`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
|
`Python is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
|
||||||
);
|
);
|
||||||
try {
|
|
||||||
const version = resolveVersionInput();
|
|
||||||
const checkLatest = core.getBooleanInput('check-latest');
|
|
||||||
|
|
||||||
if (version) {
|
if (isPyPy) {
|
||||||
let pythonVersion: string;
|
|
||||||
const arch: string = core.getInput('architecture') || os.arch();
|
|
||||||
const updateEnvironment = core.getBooleanInput('update-environment');
|
|
||||||
if (isPyPyVersion(version)) {
|
|
||||||
const installed = await finderPyPy.findPyPyVersion(
|
const installed = await finderPyPy.findPyPyVersion(
|
||||||
version,
|
version,
|
||||||
arch,
|
arch,
|
||||||
|
Loading…
Reference in New Issue
Block a user