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:
parent
ffcd00020c
commit
00a5248c77
16 changed files with 2083 additions and 1552 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue