@@ -121,15 +121,11 @@ export async function useCpythonVersion(
121
121
core . exportVariable ( 'PKG_CONFIG_PATH' , installDir + '/lib/pkgconfig' ) ;
122
122
123
123
if ( IS_LINUX ) {
124
- const libPath = process . env . LD_LIBRARY_PATH
125
- ? `:${ process . env . LD_LIBRARY_PATH } `
126
- : '' ;
127
124
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 ) ;
132
127
}
128
+
133
129
core . addPath ( installDir ) ;
134
130
core . addPath ( _binDir ) ;
135
131
@@ -159,6 +155,17 @@ export async function useCpythonVersion(
159
155
return { impl : 'CPython' , version : installed } ;
160
156
}
161
157
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
+
162
169
/** Convert versions like `3.8-dev` to a version like `~3.8.0-0`. */
163
170
function desugarDevVersion ( versionSpec : string ) {
164
171
const devVersion = / ^ ( \d + ) \. ( \d + ) - d e v $ / ;
0 commit comments