Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
Added flag to pass for user-installation of python module.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Kuck committed Jul 15, 2019
1 parent c2befb9 commit 6bf7f78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ option( BUILD_PYTHON "HELP: BUILD_PYTHON: SWITCH, Default = OFF, Turn on process
option( USE_RPATH "HELP: USE_RPATH: SWITCH, Default= ON, Set RPATH in libraries and binaries." ON )
option( PIP_WHEEL_SWITCH "HELP: PIP_WHEEL_SWITCH: SWITCH, Default= OFF, Build a PIP installable wheel." OFF )
option( BUILD_FOR_PACKAGE_SWITCH "HELP: BUILD_FOR_PACKAGE_SWITCH: SWITCH, Default= OFF, Modify python install paths assuming creation of deb/rpm." OFF )
option( PYTHON_USER_INSTALL "HELP: PYTHON_USER_INSTALL: SWITCH, Default= OFF, Install python in user mode." OFF )

if( PYTHON_USER_INSTALL AND !BUILD_PYTHON )
message( WARNING "Combination of PYTHON_USER_INSTALL=ON and BUILD_PYTHON=OFF is not allowed. " )
message( WARNING "Setting BUILD_PYTHON = TRUE" )
set( BUILD_PYTHON TRUE )
endif()

if( PIP_WHEEL_SWITCH AND !BUILD_PYTHON )
message( WARNING "Combination of PIP_WHEEL_SWITCH=ON and BUILD_PYTHON=OFF is not allowed. Wheels depend on python module." )
Expand Down
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ while getopts "hb:cdepi:j:xnP:sutTgv" OPTION; do
u) install=1
install_prefix=${gpstk:-$user_install_prefix}
python_install=$user_python_install
user_install=1
;;
s) install=1
install_prefix=$system_install_prefix
Expand Down Expand Up @@ -232,6 +233,7 @@ fi
args+=${install_prefix:+" -DCMAKE_INSTALL_PREFIX=$install_prefix"}
args+=${build_ext:+" -DBUILD_EXT=ON"}
args+=${verbose:+" -DDEBUG_SWITCH=ON"}
args+=${user_install:+" -DPYTHON_USER_INSTALL=ON"}
args+=${test_switch:+" -DTEST_SWITCH=ON"}
args+=${coverage_switch:+" -DCOVERAGE_SWITCH=ON"}
args+=${build_docs:+" --graphviz=$build_root/doc/graphviz/gpstk_graphviz.dot"}
Expand Down
3 changes: 3 additions & 0 deletions swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ configure_file( ${GPSTK_ROOT_PY_IN} ${GPSTK_ROOT_PY} )
if( BUILD_FOR_PACKAGE_SWITCH )
# If building for a package, use the "root" switch to imitate the system package path
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --root=${PYTHON_INSTALL_PREFIX} WORKING_DIRECTORY ${MODULE_PATH})" )
elseif( PYTHON_USER_INSTALL )
# If performing a user-install, use the `--user` flag, otherwise it may not create the correct directores.
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --user WORKING_DIRECTORY ${MODULE_PATH})" )
else()
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install --prefix=${PYTHON_INSTALL_PREFIX} WORKING_DIRECTORY ${MODULE_PATH})" )
endif()
Expand Down

0 comments on commit 6bf7f78

Please sign in to comment.