From 69b94463f514b2e3874657553880d9cd8693e693 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Tue, 28 Jun 2022 08:37:00 +0200 Subject: [PATCH 1/3] Add CMake hints --- dist/setup/index.js | 33 +++++++++++++++++++++++++++++++++ src/find-pypy.ts | 6 ++++++ src/find-python.ts | 20 ++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index cdd0f70..382db12 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63884,12 +63884,25 @@ function findPyPyVersion(versionSpec, architecture, updateEnvironment) { const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`); const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir); +<<<<<<< HEAD if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); core.addPath(pythonLocation); core.addPath(_binDir); } +======= + core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); + core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); + core.addPath(pythonLocation); + core.addPath(_binDir); +>>>>>>> 31fd3d4 (Add CMake hints) core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim()); core.setOutput('python-path', pythonPath); return { resolvedPyPyVersion, resolvedPythonVersion }; @@ -64042,6 +64055,26 @@ function useCpythonVersion(version, architecture, updateEnvironment) { `The list of all available versions can be found here: ${installer.MANIFEST_URL}` ].join(os.EOL)); } +<<<<<<< HEAD +======= + core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); + core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); + if (utils_1.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); + } + } +>>>>>>> 31fd3d4 (Add CMake hints) const _binDir = binDir(installDir); const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`); diff --git a/src/find-pypy.ts b/src/find-pypy.ts index a194962..3cc3fdd 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -57,6 +57,12 @@ export async function findPyPyVersion( const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir); if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); core.addPath(pythonLocation); core.addPath(_binDir); diff --git a/src/find-python.ts b/src/find-python.ts index 9675960..339c615 100644 --- a/src/find-python.ts +++ b/src/find-python.ts @@ -70,6 +70,26 @@ export async function useCpythonVersion( ); } + core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); + core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); + + 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); + } + } + const _binDir = binDir(installDir); const binaryExtension = IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join( From 63086c6dedb585bdcbe92068dcf2e8229aadda5d Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 30 Jun 2022 07:46:53 +0200 Subject: [PATCH 2/3] rebase main --- dist/setup/index.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 382db12..a6c62ec 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63884,25 +63884,18 @@ function findPyPyVersion(versionSpec, architecture, updateEnvironment) { const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`); const pythonLocation = pypyInstall.getPyPyBinaryPath(installDir); -<<<<<<< HEAD if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); core.addPath(pythonLocation); core.addPath(_binDir); } -======= - core.exportVariable('pythonLocation', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython - core.exportVariable('Python_ROOT_DIR', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 - core.exportVariable('Python2_ROOT_DIR', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 - core.exportVariable('Python3_ROOT_DIR', installDir); - core.exportVariable('PKG_CONFIG_PATH', pythonLocation + '/lib/pkgconfig'); - core.addPath(pythonLocation); - core.addPath(_binDir); ->>>>>>> 31fd3d4 (Add CMake hints) core.setOutput('python-version', 'pypy' + resolvedPyPyVersion.trim()); core.setOutput('python-path', pythonPath); return { resolvedPyPyVersion, resolvedPythonVersion }; @@ -64055,8 +64048,6 @@ function useCpythonVersion(version, architecture, updateEnvironment) { `The list of all available versions can be found here: ${installer.MANIFEST_URL}` ].join(os.EOL)); } -<<<<<<< HEAD -======= core.exportVariable('pythonLocation', installDir); // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython core.exportVariable('Python_ROOT_DIR', installDir); @@ -64074,7 +64065,6 @@ function useCpythonVersion(version, architecture, updateEnvironment) { core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath); } } ->>>>>>> 31fd3d4 (Add CMake hints) const _binDir = binDir(installDir); const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : ''; const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`); From e629242ad48d47433d193493ea6cfb63b06c58e3 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Thu, 30 Jun 2022 07:56:08 +0200 Subject: [PATCH 3/3] Fix failed check --- dist/setup/index.js | 16 ++++++++-------- src/find-python.ts | 17 ++++++++--------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index a6c62ec..b98b9af 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -64048,14 +64048,6 @@ function useCpythonVersion(version, architecture, updateEnvironment) { `The list of all available versions can be found here: ${installer.MANIFEST_URL}` ].join(os.EOL)); } - core.exportVariable('pythonLocation', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython - core.exportVariable('Python_ROOT_DIR', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 - core.exportVariable('Python2_ROOT_DIR', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 - core.exportVariable('Python3_ROOT_DIR', installDir); - core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); if (utils_1.IS_LINUX) { const libPath = process.env.LD_LIBRARY_PATH ? `:${process.env.LD_LIBRARY_PATH}` @@ -64071,6 +64063,14 @@ function useCpythonVersion(version, architecture, updateEnvironment) { if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); + core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); + core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); if (utils_1.IS_LINUX) { const libPath = process.env.LD_LIBRARY_PATH ? `:${process.env.LD_LIBRARY_PATH}` diff --git a/src/find-python.ts b/src/find-python.ts index 339c615..8c085d6 100644 --- a/src/find-python.ts +++ b/src/find-python.ts @@ -70,15 +70,6 @@ export async function useCpythonVersion( ); } - core.exportVariable('pythonLocation', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython - core.exportVariable('Python_ROOT_DIR', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 - core.exportVariable('Python2_ROOT_DIR', installDir); - // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 - core.exportVariable('Python3_ROOT_DIR', installDir); - core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); - if (IS_LINUX) { const libPath = process.env.LD_LIBRARY_PATH ? `:${process.env.LD_LIBRARY_PATH}` @@ -99,6 +90,14 @@ export async function useCpythonVersion( if (updateEnvironment) { core.exportVariable('pythonLocation', installDir); core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); + core.exportVariable('pythonLocation', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython + core.exportVariable('Python_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython2.html#module:FindPython2 + core.exportVariable('Python2_ROOT_DIR', installDir); + // https://cmake.org/cmake/help/latest/module/FindPython3.html#module:FindPython3 + core.exportVariable('Python3_ROOT_DIR', installDir); + core.exportVariable('PKG_CONFIG_PATH', installDir + '/lib/pkgconfig'); if (IS_LINUX) { const libPath = process.env.LD_LIBRARY_PATH