Skip to content

Commit

Permalink
fix: set python version first
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Nov 28, 2024
1 parent 2f3a9be commit 77353da
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
24 changes: 12 additions & 12 deletions dist/setup-pdm.js
Original file line number Diff line number Diff line change
Expand Up @@ -84127,7 +84127,7 @@ var import_node_process4 = __toESM(require("node:process"));
var core8 = __toESM(require_core());
var import_exec2 = __toESM(require_exec());

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/utils.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/utils.ts
var cache = __toESM(require_cache2());
var core = __toESM(require_core());
var import_fs = __toESM(require("fs"));
Expand Down Expand Up @@ -90391,12 +90391,12 @@ var defaults = {
var got = create_default(defaults);
var source_default2 = got;

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
var os2 = __toESM(require("os"));
var path3 = __toESM(require("path"));
var semver2 = __toESM(require_semver4());

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-python.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-python.ts
var path2 = __toESM(require("path"));
var core2 = __toESM(require_core());
var tc = __toESM(require_tool_cache());
Expand Down Expand Up @@ -90485,7 +90485,7 @@ async function installCpythonFromRelease(release) {
}
}

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
var core3 = __toESM(require_core());
var tc2 = __toESM(require_tool_cache());
function binDir(installDir) {
Expand Down Expand Up @@ -90608,10 +90608,10 @@ function pythonVersionToSemantic(versionSpec, allowPreReleases) {
return result;
}

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
var path5 = __toESM(require("path"));

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-pypy.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-pypy.ts
var os3 = __toESM(require("os"));
var path4 = __toESM(require("path"));
var core4 = __toESM(require_core());
Expand Down Expand Up @@ -90811,7 +90811,7 @@ function replaceX32toX86(architecture) {
return architecture;
}

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
var semver4 = __toESM(require_semver4());
var core5 = __toESM(require_core());
var tc4 = __toESM(require_tool_cache());
Expand Down Expand Up @@ -91111,19 +91111,19 @@ async function run() {
cmdArgs.push("--version", pdmVersion);
cmdArgs.push("-o", "install-output.json");
try {
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
if (import_node_process4.default.platform === "linux") {
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
}
await (0, import_exec2.exec)(IS_WINDOWS ? "python" : "python3", cmdArgs, { input: await fetchUrlAsBuffer(INSTALL_SCRIPT_URL) });
const installOutput = JSON.parse(await readFile("install-output.json"));
core8.debug(`Install output: ${installOutput}`);
core8.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`);
core8.setOutput("pdm-version", installOutput.pdm_version);
core8.setOutput("pdm-bin", import_node_path2.default.join(installOutput.install_location, installOutput.pdm_bin));
core8.addPath(import_node_path2.default.dirname(installOutput.pdm_bin));
if (core8.getBooleanInput("enable-pep582"))
core8.exportVariable("PYTHONPATH", getPep582Path(installOutput.install_location, installOutput.install_python_version));
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
if (import_node_process4.default.platform === "linux") {
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
}
core8.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`);
const matchersPath = import_node_path2.default.join(__dirname, "..", ".github");
core8.info(`##[add-matcher]${import_node_path2.default.join(matchersPath, "python.json")}`);
if (isCacheAvailable())
Expand Down
14 changes: 7 additions & 7 deletions src/setup-pdm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ async function run(): Promise<void> {
cmdArgs.push('-o', 'install-output.json')
// Use the default python version installed with the runner
try {
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)

if (process.platform === 'linux') {
// See https://github.com/actions/virtual-environments/issues/2803
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
}
await exec(IS_WINDOWS ? 'python' : 'python3', cmdArgs, { input: await utils.fetchUrlAsBuffer(INSTALL_SCRIPT_URL) })
const installOutput: InstallOutput = JSON.parse(await utils.readFile('install-output.json'))
core.debug(`Install output: ${installOutput}`)
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
core.setOutput('pdm-version', installOutput.pdm_version)
core.setOutput('pdm-bin', path.join(installOutput.install_location, installOutput.pdm_bin))
core.addPath(path.dirname(installOutput.pdm_bin))
if (core.getBooleanInput('enable-pep582'))
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version))

const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)

if (process.platform === 'linux') {
// See https://github.com/actions/virtual-environments/issues/2803
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
}
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
const matchersPath = path.join(__dirname, '..', '.github')
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`)
if (utils.isCacheAvailable())
Expand Down

0 comments on commit 77353da

Please sign in to comment.