Commit 5fa95c45 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Merge branch 'ed135_add_pyrs_to_app_wrap' into 'main'

update pyrs wrapper script to support conda env install

See merge request !13
parents 9642a100 9205d7f0
Loading
Loading
Loading
Loading
Loading
+23 −21
Original line number Diff line number Diff line
#!/bin/sh
# This is currently launching things from /SNS/software. When pyrs is
# deployed through conda this method should change.
#!/bin/bash

# determine which version to run
PYRS=/SNS/software/PyRS/pyrs.sh
if [ "$#" -ge 1 ]; then
    if [ "$1" = "--dev" ]; then
        echo "Starting development version"
        PYRS=/SNS/software/PyRS-dev/pyrs.sh
        shift  # drop the argument
    elif [ "$1" = "--qa" ]; then
        echo "Starting qa version"
        PYRS=/SNS/software/PyRS-qa/pyrs.sh
        shift  # drop the argument
    fi  # otherwise do nothing
# select the environment to use
# current default is system version
if [ -n "$1" ]; then
  if [ "$1" == "--dev" ]; then
    CONDA_ENVIRON=pyrs-dev
    shift  # drop this argument
  elif [ "$1" == "--qa" ]; then
    CONDA_ENVIRON=pyrs-qa
    shift  # drop this argument
  fi
fi

if [ -v CONDA_ENVIRON ]; then
    # import library to do the real work
    source "$(dirname "$(realpath "$0")")/nsd-app-wrap.sh"

# start pyrs
if [ -f ${PYRS} ]; then
    # shellcheck disable=SC2068
    ${PYRS} $@
    # put together arguments - conda_env, application, argv
    args=("${CONDA_ENVIRON}" "pyrsplot" "$@")
else
    echo "Failed to find ${PYRS}"
    exit 255
    # launch system installed pyrs
    /SNS/software/PyRS/pyrs.sh
    exit 0
fi

# start the application
activate_and_launch "${args[@]}"