1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-python synced 2025-06-09 04:42:20 +02:00

feature: add update-environment input (#411)

This option allows to specify if the action shall update environment variables (default) or not.
This allows to use the setup-python action in a composite action without side effect (except downloading/installing python if version is missing).
This commit is contained in:
Matthieu Darbois 2022-06-29 17:00:51 +02:00 committed by GitHub
parent ffcd00020c
commit 00a5248c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 2083 additions and 1552 deletions

View file

@ -20,7 +20,8 @@ interface IPyPyVersionSpec {
export async function findPyPyVersion(
versionSpec: string,
architecture: string
architecture: string,
updateEnvironment: boolean
): Promise<{resolvedPyPyVersion: string; resolvedPythonVersion: string}> {
let resolvedPyPyVersion = '';
let resolvedPythonVersion = '';
@ -54,10 +55,12 @@ export async function findPyPyVersion(
`python${binaryExtension}`
);
const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
core.exportVariable('pythonLocation', installDir);
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
core.addPath(pythonLocation);
core.addPath(_binDir);
if (updateEnvironment) {
core.exportVariable('pythonLocation', installDir);
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
core.addPath(pythonLocation);
core.addPath(_binDir);
}
core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim());
core.setOutput('python-path', pythonPath);