mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 07:22:14 +00:00
Adding LD_LIBRARY_PATH env var to both setup and install tasks
This commit is contained in:
parent
c181ffa198
commit
2513d89ee3
2 changed files with 18 additions and 0 deletions
|
@ -9,6 +9,7 @@ import * as core from '@actions/core';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
const IS_LINUX = process.platform === 'linux';
|
||||||
|
|
||||||
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
|
// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
|
||||||
// This is where pip is, along with anything that pip installs.
|
// This is where pip is, along with anything that pip installs.
|
||||||
|
@ -109,6 +110,18 @@ async function useCpythonVersion(
|
||||||
}
|
}
|
||||||
|
|
||||||
core.exportVariable('pythonLocation', installDir);
|
core.exportVariable('pythonLocation', installDir);
|
||||||
|
|
||||||
|
if (IS_LINUX) {
|
||||||
|
const libPath = process.env.LD_LIBRARY_PATH
|
||||||
|
? `:${process.env.LD_LIBRARY_PATH}`
|
||||||
|
: '';
|
||||||
|
const pyLibPath = path.join(installDir, 'lib');
|
||||||
|
|
||||||
|
if (!libPath.split(':').includes(pyLibPath)) {
|
||||||
|
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
core.addPath(installDir);
|
core.addPath(installDir);
|
||||||
core.addPath(binDir(installDir));
|
core.addPath(binDir(installDir));
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ const MANIFEST_REPO_BRANCH = 'main';
|
||||||
export const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`;
|
export const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`;
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
const IS_LINUX = process.platform === 'linux';
|
||||||
|
|
||||||
export async function findReleaseFromManifest(
|
export async function findReleaseFromManifest(
|
||||||
semanticVersionSpec: string,
|
semanticVersionSpec: string,
|
||||||
|
@ -35,6 +36,10 @@ export async function findReleaseFromManifest(
|
||||||
async function installPython(workingDirectory: string) {
|
async function installPython(workingDirectory: string) {
|
||||||
const options: ExecOptions = {
|
const options: ExecOptions = {
|
||||||
cwd: workingDirectory,
|
cwd: workingDirectory,
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
...(IS_LINUX && {LD_LIBRARY_PATH: path.join(workingDirectory, 'lib')})
|
||||||
|
},
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data: Buffer) => {
|
stdout: (data: Buffer) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue