Skip to content

Commit 36977c0

Browse files
committed
Extend LIBRARY_PATH as well as LD_LIBRARY_PATH on Linux
1 parent 39cd149 commit 36977c0

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/find-python.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,11 @@ export async function useCpythonVersion(
121121
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
122122

123123
if (IS_LINUX) {
124-
const libPath = process.env.LD_LIBRARY_PATH
125-
? `:${process.env.LD_LIBRARY_PATH}`
126-
: '';
127124
const pyLibPath = path.join(installDir, 'lib');
128-
129-
if (!libPath.split(':').includes(pyLibPath)) {
130-
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
131-
}
125+
ensurePathInEnvVar('LIBRARY_PATH', pyLibPath);
126+
ensurePathInEnvVar('LD_LIBRARY_PATH', pyLibPath);
132127
}
128+
133129
core.addPath(installDir);
134130
core.addPath(_binDir);
135131

@@ -159,6 +155,17 @@ export async function useCpythonVersion(
159155
return {impl: 'CPython', version: installed};
160156
}
161157

158+
/** Ensure a folder is present in a colon-separated env-var */
159+
function ensurePathInEnvVar(envVarName: string, extraPath: string) {
160+
const currentPath = process.env[envVarName]
161+
? `:${process.env[envVarName]}`
162+
: '';
163+
164+
if (!currentPath.split(':').includes(extraPath)) {
165+
core.exportVariable(envVarName, extraPath + currentPath);
166+
}
167+
}
168+
162169
/** Convert versions like `3.8-dev` to a version like `~3.8.0-0`. */
163170
function desugarDevVersion(versionSpec: string) {
164171
const devVersion = /^(\d+)\.(\d+)-dev$/;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy