whatis([==[
Creates $USERAPPL environment variable and adds paths
]==])

local pyver = subprocess([[python --version 2>&1 | sed 's/.*\([23]\.[0-9]\).*/\1/']])
if pyver:sub(1, 1) == "2" then
    LmodError("Must have Python 3 loaded")
end

local home      = os.getenv("HOME")
local nobackup  = pathJoin(home, "nobackup")
local userappl  = pathJoin(nobackup, "appl")
local git       = pathJoin(nobackup, "git")
local pythonp   = pathJoin(userappl, "lib", "python" .. pyver, "site-packages")
local binp      = pathJoin(userappl, "bin")
local libp      = pathJoin(userappl, "lib")

setenv("MYNOBACKUP", nobackup)
setenv("USERAPPL", userappl)

prepend_path("PYTHONPATH", pythonp)
prepend_path("PYTHONPATH", ".")
prepend_path("PATH", binp)
prepend_path("LD_LIBRARY_PATH", libp)
execute {cmd='`snakemake --bash-completion`', modeA={"load"}}
