File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import * as semver from 'semver';
66import * as core from '@actions/core' ;
77import * as tc from '@actions/tool-cache' ;
88
9+ import {
10+ addPkgConfigPathToEnv
11+ } from './utils' ;
12+
913export async function findGraalPyVersion (
1014 versionSpec : string ,
1115 architecture : string ,
@@ -67,7 +71,7 @@ export async function findGraalPyVersion(
6771 core . exportVariable ( 'Python2_ROOT_DIR' , installDir ) ;
6872 // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
6973 core . exportVariable ( 'Python3_ROOT_DIR' , installDir ) ;
70- core . exportVariable ( 'PKG_CONFIG_PATH' , pythonLocation + '/lib/pkgconfig' ) ;
74+ addPkgConfigPathToEnv ( pythonLocation + '/lib/pkgconfig' ) ;
7175 core . addPath ( pythonLocation ) ;
7276 core . addPath ( _binDir ) ;
7377 }
Original file line number Diff line number Diff line change 88 readExactPyPyVersionFile ,
99 validatePythonVersionFormatForPyPy ,
1010 IPyPyManifestRelease ,
11- getBinaryDirectory
11+ getBinaryDirectory ,
12+ addPkgConfigPathToEnv
1213} from './utils' ;
1314
1415import * as semver from 'semver' ;
@@ -92,7 +93,8 @@ export async function findPyPyVersion(
9293 core . exportVariable ( 'Python2_ROOT_DIR' , installDir ) ;
9394 // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
9495 core . exportVariable ( 'Python3_ROOT_DIR' , installDir ) ;
95- core . exportVariable ( 'PKG_CONFIG_PATH' , pythonLocation + '/lib/pkgconfig' ) ;
96+ addPkgConfigPathToEnv ( pythonLocation + '/lib/pkgconfig' ) ;
97+
9698 core . addPath ( pythonLocation ) ;
9799 core . addPath ( _binDir ) ;
98100 }
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import * as core from '@actions/core';
1010import * as tc from '@actions/tool-cache' ;
1111import * as exec from '@actions/exec' ;
1212
13+ import {
14+ addPkgConfigPathToEnv
15+ } from './utils' ;
16+
1317// Python has "scripts" or "bin" directories where command-line tools that come with packages are installed.
1418// This is where pip is, along with anything that pip installs.
1519// There is a separate directory for `pip install --user`.
@@ -150,15 +154,15 @@ export async function useCpythonVersion(
150154 ) ;
151155 if ( updateEnvironment ) {
152156 core . exportVariable ( 'pythonLocation' , installDir ) ;
153- core . exportVariable ( 'PKG_CONFIG_PATH' , installDir + '/lib/pkgconfig' ) ;
154157 core . exportVariable ( 'pythonLocation' , installDir ) ;
155158 // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
156159 core . exportVariable ( 'Python_ROOT_DIR' , installDir ) ;
157160 // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
158161 core . exportVariable ( 'Python2_ROOT_DIR' , installDir ) ;
159162 // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
160163 core . exportVariable ( 'Python3_ROOT_DIR' , installDir ) ;
161- core . exportVariable ( 'PKG_CONFIG_PATH' , installDir + '/lib/pkgconfig' ) ;
164+
165+ addPkgConfigPathToEnv ( installDir + '/lib/pkgconfig' ) ;
162166
163167 if ( IS_LINUX ) {
164168 const libPath = process . env . LD_LIBRARY_PATH
Original file line number Diff line number Diff line change @@ -422,3 +422,18 @@ export function getDownloadFileName(downloadUrl: string): string | undefined {
422422 ? path . join ( tempDir , path . basename ( downloadUrl ) )
423423 : undefined ;
424424}
425+
426+
427+ export function addPkgConfigPathToEnv ( path : string ) : undefined {
428+ const pkg_config_path = process . env [ "PKG_CONFIG_PATH" ] ;
429+
430+ if ( pkg_config_path === undefined ) {
431+ core . exportVariable ( 'PKG_CONFIG_PATH' , path ) ;
432+ } else {
433+ if ( IS_WINDOWS ) {
434+ core . exportVariable ( 'PKG_CONFIG_PATH' , `${ path } ;${ pkg_config_path } ` ) ;
435+ } else {
436+ core . exportVariable ( 'PKG_CONFIG_PATH' , `${ path } :${ pkg_config_path } ` ) ;
437+ }
438+ }
439+ }
You can’t perform that action at this time.
0 commit comments