mirror of
https://gitea.com/actions/setup-python.git
synced 2025-10-26 07:16:42 +00:00
graalpy: add graalpy early-access and windows builds (#880)
This commit is contained in:
36
dist/setup/index.js
vendored
36
dist/setup/index.js
vendored
@@ -96769,8 +96769,8 @@ async function findGraalPyVersion(versionSpec, architecture, updateEnvironment,
|
||||
const pipDir = utils_1.IS_WINDOWS ? 'Scripts' : 'bin';
|
||||
const _binDir = path.join(installDir, pipDir);
|
||||
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
|
||||
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
|
||||
const pythonLocation = (0, utils_1.getBinaryDirectory)(installDir);
|
||||
const pythonPath = path.join(_binDir, `python${binaryExtension}`);
|
||||
const pythonLocation = path.join(installDir, 'bin');
|
||||
if (updateEnvironment) {
|
||||
core.exportVariable('pythonLocation', installDir);
|
||||
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
|
||||
@@ -97315,7 +97315,12 @@ async function installGraalPy(graalpyVersion, architecture, allowPreReleases, re
|
||||
try {
|
||||
const graalpyPath = await tc.downloadTool(downloadUrl, undefined, AUTH);
|
||||
core.info('Extracting downloaded archive...');
|
||||
downloadDir = await tc.extractTar(graalpyPath);
|
||||
if (utils_1.IS_WINDOWS) {
|
||||
downloadDir = await tc.extractZip(graalpyPath);
|
||||
}
|
||||
else {
|
||||
downloadDir = await tc.extractTar(graalpyPath);
|
||||
}
|
||||
// root folder in archive can have unpredictable name so just take the first folder
|
||||
// downloadDir is unique folder under TEMP and can't contain any other folders
|
||||
const archiveName = fs_1.default.readdirSync(downloadDir)[0];
|
||||
@@ -97324,7 +97329,7 @@ async function installGraalPy(graalpyVersion, architecture, allowPreReleases, re
|
||||
if (!(0, utils_1.isNightlyKeyword)(resolvedGraalPyVersion)) {
|
||||
installDir = await tc.cacheDir(toolDir, 'GraalPy', resolvedGraalPyVersion, architecture);
|
||||
}
|
||||
const binaryPath = (0, utils_1.getBinaryDirectory)(installDir);
|
||||
const binaryPath = path.join(installDir, 'bin');
|
||||
await createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
|
||||
await installPip(binaryPath);
|
||||
return { installDir, resolvedGraalPyVersion };
|
||||
@@ -97352,6 +97357,9 @@ async function getAvailableGraalPyVersions() {
|
||||
if (AUTH) {
|
||||
headers.authorization = AUTH;
|
||||
}
|
||||
/*
|
||||
Get releases first.
|
||||
*/
|
||||
let url = 'https://api.github.com/repos/oracle/graalpython/releases';
|
||||
const result = [];
|
||||
do {
|
||||
@@ -97362,6 +97370,19 @@ async function getAvailableGraalPyVersions() {
|
||||
result.push(...response.result);
|
||||
url = (0, utils_1.getNextPageUrl)(response);
|
||||
} while (url);
|
||||
/*
|
||||
Add pre-release builds.
|
||||
*/
|
||||
url =
|
||||
'https://api.github.com/repos/graalvm/graal-languages-ea-builds/releases';
|
||||
do {
|
||||
const response = await http.getJson(url, headers);
|
||||
if (!response.result) {
|
||||
throw new Error(`Unable to retrieve the list of available GraalPy versions from '${url}'`);
|
||||
}
|
||||
result.push(...response.result);
|
||||
url = (0, utils_1.getNextPageUrl)(response);
|
||||
} while (url);
|
||||
return result;
|
||||
}
|
||||
async function createGraalPySymlink(graalpyBinaryPath, graalpyVersion) {
|
||||
@@ -97381,7 +97402,7 @@ async function installPip(pythonLocation) {
|
||||
await exec.exec(`${pythonBinary} -m ensurepip --default-pip`);
|
||||
}
|
||||
function graalPyTagToVersion(tag) {
|
||||
const versionPattern = /.*-(\d+\.\d+\.\d+(?:\.\d+)?)((?:a|b|rc))?(\d*)?/;
|
||||
const versionPattern = /.*-(\d+\.\d+\.\d+(?:\.\d+)?)(?:-((?:ea|a|b|rc))\.0*(\d+))?/;
|
||||
const match = tag.match(versionPattern);
|
||||
if (match && match[2]) {
|
||||
return `${match[1]}-${match[2]}.${match[3]}`;
|
||||
@@ -97431,8 +97452,9 @@ function toGraalPyArchitecture(architecture) {
|
||||
function findAsset(item, architecture, platform) {
|
||||
const graalpyArch = toGraalPyArchitecture(architecture);
|
||||
const graalpyPlatform = toGraalPyPlatform(platform);
|
||||
const graalpyExt = platform == 'win32' ? 'zip' : 'tar.gz';
|
||||
const found = item.assets.filter(file => file.name.startsWith('graalpy') &&
|
||||
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.tar.gz`));
|
||||
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.${graalpyExt}`));
|
||||
/*
|
||||
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
||||
*/
|
||||
@@ -98363,7 +98385,7 @@ function getVersionInputFromFile(versionFile) {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get the directory containing interpreter binary from installation directory of PyPy or GraalPy
|
||||
* Get the directory containing interpreter binary from installation directory of PyPy
|
||||
* - On Linux and macOS, the Python interpreter is in 'bin'.
|
||||
* - On Windows, it is in the installation root.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user