From ba61c9777ad5ef1d3203e9b981fc2200684df1ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gonzalo=20Garramu=C3=B1o?= Date: Sun, 15 Oct 2023 13:14:19 -0300 Subject: [PATCH] Added python.sh.in to configure it to run python on Unix systems. --- mrv2/bin/python.sh.in | 38 ++++++++++++++++++++++++++++++++++++++ mrv2/src/CMakeLists.txt | 13 +++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 mrv2/bin/python.sh.in diff --git a/mrv2/bin/python.sh.in b/mrv2/bin/python.sh.in new file mode 100644 index 000000000..0beaa3313 --- /dev/null +++ b/mrv2/bin/python.sh.in @@ -0,0 +1,38 @@ +#!/bin/bash + +if [[ $BASH_SOURCE != $0 ]]; then + dir=$BASH_SOURCE +else + dir=$0 +fi + + +symlink=`readlink ${dir}` + +if [ "$symlink" != "" ]; then + dir="$symlink" + dir=${dir%/*} +else +# Find directory where mrv2 bash script resides + dir=${dir%/*} +fi + +# If running from current directory, get full path +if [ "$dir" == '.' ]; then + dir=$PWD +fi + +source "$dir/environment.sh" + +params="" + +for param in "$@" +do + params="${params} \"${param}\"" +done + + +# +# Start up python +# +sh -c "${dir}/bin/python@MRV2_PYTHON_VERSION@ $params" diff --git a/mrv2/src/CMakeLists.txt b/mrv2/src/CMakeLists.txt index 84679af4e..216c16654 100644 --- a/mrv2/src/CMakeLists.txt +++ b/mrv2/src/CMakeLists.txt @@ -104,6 +104,10 @@ if ( APPLE ) install( FILES ${CMAKE_INSTALL_PREFIX}/bin/python${MRV2_PYTHON_VERSION} DESTINATION bin/ + PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE COMPONENT applications ) endif() @@ -119,6 +123,10 @@ elseif ( UNIX ) install( FILES ${CMAKE_INSTALL_PREFIX}/bin/python${MRV2_PYTHON_VERSION} DESTINATION bin/ + PERMISSIONS + OWNER_READ OWNER_WRITE OWNER_EXECUTE + GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE COMPONENT applications ) endif() @@ -180,9 +188,14 @@ if ( NOT WIN32 ) configure_file(${CMAKE_SOURCE_DIR}/bin/environment.sh.in ${CMAKE_INSTALL_PREFIX}/bin/environment.sh @ONLY) + # Configure python.sh with python path + configure_file(${CMAKE_SOURCE_DIR}/bin/python.sh.in + ${CMAKE_INSTALL_PREFIX}/bin/python.sh @ONLY) + install( FILES ${CMAKE_SOURCE_DIR}/bin/mrv2.sh ${CMAKE_INSTALL_PREFIX}/bin/environment.sh + ${CMAKE_INSTALL_PREFIX}/bin/python.sh DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE