diff mbox

[rdma-core,1/2] buildlib: use cmake to find python

Message ID 1923c475-0597-a597-36a5-8a33cccae6ef@suse.de (mailing list archive)
State Accepted
Headers show

Commit Message

Nicolas Morey-Chaisemartin Nov. 13, 2017, 1 p.m. UTC
Depending on the system, python might not be available as pythomn (but python2, python3, etc.)
Use FIND_PACKAGE to get the right executable.

Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
---
 CMakeLists.txt                | 3 +++
 buildlib/rdma_functions.cmake | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Benjamin Drung Nov. 13, 2017, 1:33 p.m. UTC | #1
Am Montag, den 13.11.2017, 14:00 +0100 schrieb Nicolas Morey-
Chaisemartin:
> Depending on the system, python might not be available as pythomn
> (but python2, python3, etc.)

I doubt that the binary is call pythomn on any system. ;)
Nicolas Morey-Chaisemartin Nov. 13, 2017, 1:35 p.m. UTC | #2
Le 13/11/2017 à 14:33, Benjamin Drung a écrit :
> Am Montag, den 13.11.2017, 14:00 +0100 schrieb Nicolas Morey-
> Chaisemartin:
>> Depending on the system, python might not be available as pythomn
>> (but python2, python3, etc.)
> I doubt that the binary is call pythomn on any system. ;)
>
Grr you're right. Fixed a typo before submitting and created another one...
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Gunthorpe Nov. 13, 2017, 7:31 p.m. UTC | #3
On Mon, Nov 13, 2017 at 02:00:15PM +0100, Nicolas Morey-Chaisemartin wrote:
> Depending on the system, python might not be available as pythomn (but python2, python3, etc.)
> Use FIND_PACKAGE to get the right executable.

Looks fine to me.

>    # Compute a relative symlink from VERBS_PROVIDER_DIR to LIBDIR
> -  execute_process(COMMAND python ${CMAKE_SOURCE_DIR}/buildlib/relpath
> +  execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/buildlib/relpath

I'm assuming this little script works with python3 ?

cbuild won't though..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Morey-Chaisemartin Nov. 13, 2017, 7:56 p.m. UTC | #4
Le 13/11/2017 à 20:31, Jason Gunthorpe a écrit :
> On Mon, Nov 13, 2017 at 02:00:15PM +0100, Nicolas Morey-Chaisemartin wrote:
>> Depending on the system, python might not be available as pythomn (but python2, python3, etc.)
>> Use FIND_PACKAGE to get the right executable.
> Looks fine to me.
>
>>    # Compute a relative symlink from VERBS_PROVIDER_DIR to LIBDIR
>> -  execute_process(COMMAND python ${CMAKE_SOURCE_DIR}/buildlib/relpath
>> +  execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/buildlib/relpath
> I'm assuming this little script works with python3 ?
>
> cbuild won't though..
>

We can work on that later.
cbuild is mostly used for testing so as long as the basic tests are not run directly on TW we should be fine.
And when the time comes, we'll find a work around for TW too.

Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e6f245a..a283fba3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,6 +279,9 @@  else()
   set(HAVE_FULL_SYMBOL_VERSIONS 1)
 endif()
 
+# Look for Python
+FIND_PACKAGE (PythonInterp)
+
 #-------------------------
 # Find libraries
 # pthread
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index d69afd3d..53a978e8 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -144,7 +144,7 @@  function(rdma_shared_provider DEST VERSION_SCRIPT SOVERSION VERSION)
   install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
 
   # Compute a relative symlink from VERBS_PROVIDER_DIR to LIBDIR
-  execute_process(COMMAND python ${CMAKE_SOURCE_DIR}/buildlib/relpath
+  execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/buildlib/relpath
     "${CMAKE_INSTALL_FULL_LIBDIR}/lib${DEST}.so.${VERSION}"
     "${VERBS_PROVIDER_DIR}"
     OUTPUT_VARIABLE DEST_LINK_PATH OUTPUT_STRIP_TRAILING_WHITESPACE