feat: add update-python input
Signed-off-by: Frost Ming <me@frostming.com>
This commit is contained in:
parent
2d86acd19c
commit
c21a0792fc
@ -6,7 +6,7 @@ inputs:
|
|||||||
python-version:
|
python-version:
|
||||||
description: "Version range or exact version of a Python version to use, using SemVer's version range syntax."
|
description: "Version range or exact version of a Python version to use, using SemVer's version range syntax."
|
||||||
default: "3.x"
|
default: "3.x"
|
||||||
required: true
|
required: false
|
||||||
architecture:
|
architecture:
|
||||||
description: "The target architecture (x86, x64) of the Python interpreter."
|
description: "The target architecture (x86, x64) of the Python interpreter."
|
||||||
required: false
|
required: false
|
||||||
@ -37,6 +37,9 @@ inputs:
|
|||||||
description: "The dependency file(s) to cache."
|
description: "The dependency file(s) to cache."
|
||||||
default: "pdm.lock"
|
default: "pdm.lock"
|
||||||
required: false
|
required: false
|
||||||
|
update-python:
|
||||||
|
description: "Whether to update the environment with the requested Python"
|
||||||
|
default: "true"
|
||||||
outputs:
|
outputs:
|
||||||
python-version:
|
python-version:
|
||||||
description: "The installed Python or PyPy version. Useful when given a version range as input."
|
description: "The installed Python or PyPy version. Useful when given a version range as input."
|
||||||
|
9
dist/setup-pdm.js
vendored
9
dist/setup-pdm.js
vendored
@ -77514,13 +77514,13 @@ async function fetchUrlAsBuffer(url) {
|
|||||||
}
|
}
|
||||||
return Buffer.from(response.body);
|
return Buffer.from(response.body);
|
||||||
}
|
}
|
||||||
async function findPythonVersion(version, architecture, allowPreReleases) {
|
async function findPythonVersion(version, architecture, allowPreReleases, updateEnvironment = true) {
|
||||||
let pythonVersion = "";
|
let pythonVersion = "";
|
||||||
if (isPyPyVersion(version)) {
|
if (isPyPyVersion(version)) {
|
||||||
const installed = await findPyPyVersion(
|
const installed = await findPyPyVersion(
|
||||||
version,
|
version,
|
||||||
architecture,
|
architecture,
|
||||||
true,
|
updateEnvironment,
|
||||||
false,
|
false,
|
||||||
allowPreReleases
|
allowPreReleases
|
||||||
);
|
);
|
||||||
@ -77533,7 +77533,7 @@ async function findPythonVersion(version, architecture, allowPreReleases) {
|
|||||||
const installed = await useCpythonVersion(
|
const installed = await useCpythonVersion(
|
||||||
version,
|
version,
|
||||||
architecture,
|
architecture,
|
||||||
true,
|
updateEnvironment,
|
||||||
false,
|
false,
|
||||||
allowPreReleases
|
allowPreReleases
|
||||||
);
|
);
|
||||||
@ -77621,6 +77621,7 @@ async function run() {
|
|||||||
const arch2 = core8.getInput("architecture") || os4.arch();
|
const arch2 = core8.getInput("architecture") || os4.arch();
|
||||||
const pdmVersion = core8.getInput("version");
|
const pdmVersion = core8.getInput("version");
|
||||||
const pythonVersion = core8.getInput("python-version");
|
const pythonVersion = core8.getInput("python-version");
|
||||||
|
const updateEnvironment = core8.getBooleanInput("update-python");
|
||||||
const allowPythonPreReleases = core8.getBooleanInput("allow-python-prereleases");
|
const allowPythonPreReleases = core8.getBooleanInput("allow-python-prereleases");
|
||||||
const cmdArgs = ["-"];
|
const cmdArgs = ["-"];
|
||||||
if (core8.getBooleanInput("prerelease")) {
|
if (core8.getBooleanInput("prerelease")) {
|
||||||
@ -77640,7 +77641,7 @@ async function run() {
|
|||||||
if (core8.getBooleanInput("enable-pep582")) {
|
if (core8.getBooleanInput("enable-pep582")) {
|
||||||
core8.exportVariable("PYTHONPATH", getPep582Path(installOutput.install_location, installOutput.install_python_version));
|
core8.exportVariable("PYTHONPATH", getPep582Path(installOutput.install_location, installOutput.install_python_version));
|
||||||
}
|
}
|
||||||
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases);
|
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
|
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ async function run(): Promise<void> {
|
|||||||
const arch = core.getInput('architecture') || os.arch();
|
const arch = core.getInput('architecture') || os.arch();
|
||||||
const pdmVersion = core.getInput('version');
|
const pdmVersion = core.getInput('version');
|
||||||
const pythonVersion = core.getInput('python-version');
|
const pythonVersion = core.getInput('python-version');
|
||||||
|
const updateEnvironment = core.getBooleanInput('update-python');
|
||||||
const allowPythonPreReleases = core.getBooleanInput('allow-python-prereleases');
|
const allowPythonPreReleases = core.getBooleanInput('allow-python-prereleases');
|
||||||
const cmdArgs = ['-'];
|
const cmdArgs = ['-'];
|
||||||
if (core.getBooleanInput('prerelease')) {
|
if (core.getBooleanInput('prerelease')) {
|
||||||
@ -50,7 +51,7 @@ async function run(): Promise<void> {
|
|||||||
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version));
|
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases);
|
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment);
|
||||||
|
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
// See https://github.com/actions/virtual-environments/issues/2803
|
// See https://github.com/actions/virtual-environments/issues/2803
|
||||||
|
@ -20,13 +20,13 @@ export async function fetchUrlAsBuffer(url: string): Promise<Buffer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function findPythonVersion(version: string, architecture: string, allowPreReleases: boolean): Promise<string> {
|
export async function findPythonVersion(version: string, architecture: string, allowPreReleases: boolean, updateEnvironment: boolean = true): Promise<string> {
|
||||||
let pythonVersion = '';
|
let pythonVersion = '';
|
||||||
if (isPyPyVersion(version)) {
|
if (isPyPyVersion(version)) {
|
||||||
const installed = await findPyPyVersion(
|
const installed = await findPyPyVersion(
|
||||||
version,
|
version,
|
||||||
architecture,
|
architecture,
|
||||||
true,
|
updateEnvironment,
|
||||||
false,
|
false,
|
||||||
allowPreReleases
|
allowPreReleases
|
||||||
);
|
);
|
||||||
@ -39,7 +39,7 @@ export async function findPythonVersion(version: string, architecture: string, a
|
|||||||
const installed = await useCpythonVersion(
|
const installed = await useCpythonVersion(
|
||||||
version,
|
version,
|
||||||
architecture,
|
architecture,
|
||||||
true,
|
updateEnvironment,
|
||||||
false,
|
false,
|
||||||
allowPreReleases
|
allowPreReleases
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user