Commits

Rob Williams committed feb770e

Integrate with latest BriteOnyx framework

  • Participants
  • Parent commits be3a0ff

Comments (0)

Files changed (8)

activate_Python_project.bash

 #       continuing execution where possible.  Exiting the shell robs the user
 #       of useful feedback and interrupts their work, which is unacceptable.
 
-[[   -z "$BO_Home" ]] && echo 'FATAL: Missing $BO_Home'             && return 1
-[[ ! -d "$BO_Home" ]] && echo "FATAL: Missing directory '$BO_Home'" && return 1
+[[   -z "$BO_Home"    ]] && echo 'FATAL: Missing $BO_Home'             && return 1
+[[   -z "$BO_Project" ]] && echo 'FATAL: Missing $BO_Project'          && return 1
+[[ ! -d "$BO_Home"    ]] && echo "FATAL: Missing directory '$BO_Home'" && return 1
 
 # Configure the Linux environment
 _Dir=$BO_Home/bin/Linux/helper
 
 # Configure the Python environment
 _Dir=$BO_Home/bin/Python/helper
-
-: <<'DisabledContent'
 requireDirectory ${_Dir}
 source ${_Dir}/configure_TMPDIR
 source ${_Dir}/configure_pip
-source ${_Dir}/configure_virtualenv
+# TODO: source ${_Dir}/configure_virtualenv
 source ${_Dir}/configure_PATH
 source ${_Dir}/configure_output
+
+: <<'DisabledContent'
 DisabledContent
 
 # Return, but do NOT exit, with a success code
-logInfo "$BASH_SOURCE" "$LINENO" "Python project activated."
+logInfo "$BASH_SOURCE" "$LINENO" "Python project '$BO_Project' activated."
 return 0
 

bin/Linux/helper/declare-BASH.bash

 #!/bin/bash
-# Declare BASH functionality for BASH
+# Declare functionality for BASH
 
 abort () {
   # Abort BASH execution with message $3 and exit status $4

bin/Linux/helper/declare-POSIX.bash

 #!/bin/bash
-# Declare BASH functionality for POSIX
+# Declare functionality for POSIX (mostly directory and file handling)
 
 changeFileGroup () {
   # Change ownership of file $2 to group $1
   abort "$FUNCNAME" "$LINENO" "Required file '$1' must exist!"
 }
 
-: <<DISABLED
+: <<'DisabledContent'
   # NOTE:  Place content to be ignored in here.
 
   # TODO:  Refactor & redesign
   [[ -e "$1" ]] && logError "Pathname $1 should not exist" && return 1
   return 0
 }
-DISABLED
+DisabledContent
 

bin/Python/helper/configure_PATH

 #!/bin/bash
-echo 'INFO: Configuring system execution $PATH...'
+logInfo 'Configuring system execution $PATH...'
 
 requireVariable BO_Home
 requireVariable BO_Project

bin/Python/helper/configure_TMPDIR

 #!/bin/bash
-echo 'INFO: Configuring temporary directory $TMPDIR...'
+logInfo 'Configuring temporary directory $TMPDIR...'
 
 requireVariable TMPDIR
-[[ ! -e "$TMPDIR" ]] && \
-  echo "INFO: Creating directory '$TMPDIR'" && \
-  mkdir -p $TMPDIR
-requireDirectory $TMPDIR
+createDirectory $TMPDIR
 
 # Return, but do NOT exit, with a success code
 return 0

bin/Python/helper/configure_output

 #!/bin/bash
-echo 'INFO:  Configuring output directory...'
+logInfo 'Configuring output directory...'
 
 requireVariable BO_Project
-_Dir=$BO_Project/out
-[[ ! -e "${_Dir}" ]] && \
-  echo "INFO:  Creating directory '${_Dir}'" && \
-  mkdir -p ${_Dir}
-requireDirectory ${_Dir}
+createDirectory $BO_Project/out
 
 # Return, but do NOT exit, with a success code
 return 0

bin/Python/helper/configure_pip

 #!/bin/bash
-echo 'INFO: Configuring PIP...'
+logInfo 'Configuring PIP...'
 
 export PIP_REQUIRE_VIRTUALENV=true
 export PIP_RESPECT_VIRTUALENV=true
 
 requireVariable PIP_DOWNLOAD_CACHE
-[[ ! -e "$PIP_DOWNLOAD_CACHE" ]] && \
-  echo "INFO: Creating directory '$PIP_DOWNLOAD_CACHE'" && \
-  mkdir -p $PIP_DOWNLOAD_CACHE
-requireDirectory $PIP_DOWNLOAD_CACHE
+createDirectory $PIP_DOWNLOAD_CACHE
 
 # Return, but do NOT exit, with a success code
 return 0

bin/Python/helper/configure_virtualenv

 #!/bin/bash
-echo 'INFO: Configuring Python virtualenv...'
+logInfo 'Configuring Python virtualenv...'
 
 # Verify PIP integration
 requireVariable PIP_DOWNLOAD_CACHE
 requireVariable PIP_REQUIRE_VIRTUALENV
 requireVariable PIP_RESPECT_VIRTUALENV
 
+requireVariable BO_Project
+_Script=$BO_Project/PVE/bin/activate
+
 # If the virtual environment does not already exist, create it
-requireVariable BO_Project
-[[ ! -f "$BO_Project/PVE/bin/activate" ]] && \
-  echo "WARN: Creating PVE!" && \
+[[ ! -f "${_Script}" ]] && \
+  logWarn 'Creating Python virtual environment (PVE)' && \
   virtualenv --no-site-packages $BO_Project/PVE
 
 # Activate the Python virtual environment (PVE)
-source $BO_Project/PVE/bin/activate
+requireDirectory $BO_Project/PVE
+requireFile ${_Script}
+source ${_Script}
 requireVariable VIRTUAL_ENV
 export PYTHONHOME=$VIRTUAL_ENV
 requireVariable PYTHONHOME