reuse the python if possible
This commit is contained in:
parent
d8ffba5266
commit
51a3c26cfe
14
dist/setup-pdm.js
vendored
14
dist/setup-pdm.js
vendored
@ -6173,19 +6173,21 @@ async function run() {
|
|||||||
const pdmVersion = core3.getInput("version");
|
const pdmVersion = core3.getInput("version");
|
||||||
const pdmPackage = pdmVersion ? `pdm==${pdmVersion}` : "pdm";
|
const pdmPackage = pdmVersion ? `pdm==${pdmVersion}` : "pdm";
|
||||||
const cmdArgs = ["-m", "pip", "install", "-U", pdmPackage];
|
const cmdArgs = ["-m", "pip", "install", "-U", pdmPackage];
|
||||||
if (core3.getInput("prerelease")) {
|
if (core3.getInput("prerelease") === "true") {
|
||||||
cmdArgs.push("--pre");
|
cmdArgs.push("--pre");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await findPythonVersion(INSTALL_VERSION, arch2);
|
let installedPython = await findPythonVersion(INSTALL_VERSION, arch2);
|
||||||
await exec3.exec("python", cmdArgs);
|
await exec3.exec("python", cmdArgs);
|
||||||
const installed = await findPythonVersion(core3.getInput("python-version"), arch2);
|
if (core3.getInput("python-version") !== INSTALL_VERSION) {
|
||||||
await exec3.exec("pdm", ["use", "-f", installed.version]);
|
installedPython = await findPythonVersion(core3.getInput("python-version"), arch2);
|
||||||
const pdmVersionOutput = (await (0, import_child_process.exec)("pdm --version")).stdout;
|
}
|
||||||
|
await exec3.exec("pdm", ["use", "-f", installedPython.version]);
|
||||||
|
const pdmVersionOutput = (await (0, import_child_process.exec)("pdm --version")).stdout?.read();
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
core3.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
|
core3.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
|
||||||
}
|
}
|
||||||
core3.info(`Successfully setup ${pdmVersionOutput} with Python ${installed.version}`);
|
core3.info(`Successfully setup ${pdmVersionOutput} with Python ${installedPython.version}`);
|
||||||
const matchersPath = import_path.default.join(__dirname, "..", ".github");
|
const matchersPath = import_path.default.join(__dirname, "..", ".github");
|
||||||
core3.info(`##[add-matcher]${import_path.default.join(matchersPath, "python.json")}`);
|
core3.info(`##[add-matcher]${import_path.default.join(matchersPath, "python.json")}`);
|
||||||
} catch (error2) {
|
} catch (error2) {
|
||||||
|
@ -7,7 +7,7 @@ import path from "path";
|
|||||||
|
|
||||||
const INSTALL_VERSION = "3.8";
|
const INSTALL_VERSION = "3.8";
|
||||||
|
|
||||||
async function run() {
|
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 pdmPackage = pdmVersion ? `pdm==${pdmVersion}` : "pdm";
|
const pdmPackage = pdmVersion ? `pdm==${pdmVersion}` : "pdm";
|
||||||
@ -16,20 +16,22 @@ async function run() {
|
|||||||
cmdArgs.push("--pre");
|
cmdArgs.push("--pre");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await setupPython.findPythonVersion(INSTALL_VERSION, arch);
|
let installedPython = await setupPython.findPythonVersion(INSTALL_VERSION, arch);
|
||||||
await exec.exec("python", cmdArgs);
|
await exec.exec("python", cmdArgs);
|
||||||
const installed = await setupPython.findPythonVersion(
|
if (core.getInput('python-version') !== INSTALL_VERSION) {
|
||||||
core.getInput("python-version"),
|
installedPython = await setupPython.findPythonVersion(
|
||||||
arch
|
core.getInput("python-version"),
|
||||||
);
|
arch
|
||||||
await exec.exec("pdm", ["use", "-f", installed.version]);
|
);
|
||||||
const pdmVersionOutput = (await execChild("pdm --version")).stdout;
|
}
|
||||||
|
await exec.exec("pdm", ["use", "-f", installedPython.version]);
|
||||||
|
const pdmVersionOutput = (await execChild("pdm --version")).stdout?.read();
|
||||||
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
|
||||||
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1');
|
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1');
|
||||||
}
|
}
|
||||||
core.info(
|
core.info(
|
||||||
`Successfully setup ${pdmVersionOutput} with Python ${installed.version}`
|
`Successfully setup ${pdmVersionOutput} with Python ${installedPython.version}`
|
||||||
);
|
);
|
||||||
const matchersPath = path.join(__dirname, '..', '.github');
|
const matchersPath = path.join(__dirname, '..', '.github');
|
||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user