8000 Merge pull request #440 from akv-platform/v-sdolin/issue-231 · actions/setup-python@ab6deb3 · GitHub
[go: up one dir, main page]

Skip to content

Commit ab6deb3

Browse files
Merge pull request #440 from akv-platform/v-sdolin/issue-231
Add CMake hints
2 parents 766e8c6 + e629242 commit ab6deb3

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

dist/setup/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63886,6 +63886,12 @@ function findPyPyVersion(versionSpec, architecture, updateEnvironment) {
6388663886
const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
6388763887
if (updateEnvironment) {
6388863888
core.exportVariable('pythonLocation', installDir);
63889+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
63890+
core.exportVariable('Python_ROOT_DIR', installDir);
63891+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
63892+
core.exportVariable('Python2_ROOT_DIR', installDir);
63893+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
63894+
core.exportVariable('Python3_ROOT_DIR', installDir);
6388963895
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
6389063896
core.addPath(pythonLocation);
6389163897
core.addPath(_binDir);
@@ -64042,12 +64048,29 @@ function useCpythonVersion(version, architecture, updateEnvironment) {
6404264048
`The list of all available versions can be found here: ${installer.MANIFEST_URL}`
6404364049
].join(os.EOL));
6404464050
}
64051+
if (utils_1.IS_LINUX) {
64052+
const libPath = process.env.LD_LIBRARY_PATH
64053+
? `:${process.env.LD_LIBRARY_PATH}`
64054+
: '';
64055+
const pyLibPath = path.join(installDir, 'lib');
64056+
if (!libPath.split(':').includes(pyLibPath)) {
64057+
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
64058+
}
64059+
}
6404564060
const _binDir = binDir(installDir);
6404664061
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
6404764062
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
6404864063
if (updateEnvironment) {
6404964064
core.exportVariable('pythonLocation', installDir);
6405064065
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
64066+
core.exportVariable('pythonLocation', installDir);
64067+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
64068+
core.exportVariable('Python_ROOT_DIR', installDir);
64069+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
64070+
core.exportVariable('Python2_ROOT_DIR', installDir);
64071+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
64072+
core.exportVariable('Python3_ROOT_DIR', installDir);
64073+
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
6405164074
if (utils_1.IS_LINUX) {
6405264075
const libPath = process.env.LD_LIBRARY_PATH
6405364076
? `:${process.env.LD_LIBRARY_PATH}`

src/find-pypy.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export async function findPyPyVersion(
5757
const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir);
5858
if (updateEnvironment) {
5959
core.exportVariable('pythonLocation', installDir);
60+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
61+
core.exportVariable('Python_ROOT_DIR', installDir);
62+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
63+
core.exportVariable('Python2_ROOT_DIR', installDir);
64+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
65+
core.exportVariable('Python3_ROOT_DIR', installDir);
6066
core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig');
6167
core.addPath(pythonLocation);
6268
core.addPath(_binDir);

src/find-python.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ export async function useCpythonVersion(
7070
);
7171
}
7272

73+
if (IS_LINUX) {
74+
const libPath = process.env.LD_LIBRARY_PATH
75+
? `:${process.env.LD_LIBRARY_PATH}`
76+
: '';
77+
const pyLibPath = path.join(installDir, 'lib');
78+
79+
if (!libPath.split(':').includes(pyLibPath)) {
80+
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
81+
}
82+
}
83+
7384
const _binDir = binDir(installDir);
7485
const binaryExtension = IS_WINDOWS ? '.exe' : '';
7586
const pythonPath = path.join(
@@ -79,6 +90,14 @@ export async function useCpythonVersion(
7990
if (updateEnvironment) {
8091
core.exportVariable('pythonLocation', installDir);
8192
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
93+
core.exportVariable('pythonLocation', installDir);
94+
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
95+
core.exportVariable('Python_ROOT_DIR', installDir);
96+
// https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2
97+
core.exportVariable('Python2_ROOT_DIR', installDir);
98+
// https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3
99+
core.exportVariable('Python3_ROOT_DIR', installDir);
100+
core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig');
82101

83102
if (IS_LINUX) {
84103
const libPath = process.env.LD_LIBRARY_PATH

0 commit comments

Comments
 (0)
0