Skip to content

Commit

Permalink
Added python.sh.in to configure it to run python on Unix systems.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Oct 15, 2023
1 parent 754e779 commit ba61c97
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
38 changes: 38 additions & 0 deletions mrv2/bin/python.sh.in
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions mrv2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ba61c97

Please sign in to comment.