Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP4:Update
spack
Adapt-shell-scripts-that-set-up-the-environment...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File Adapt-shell-scripts-that-set-up-the-environment-for-different-shells.patch of Package spack
From 360dd5abda2e7f14c87ace831ff4c9756c9d0444 Mon Sep 17 00:00:00 2001 From: Egbert Eich <eich@suse.com> Date: Wed, 10 Nov 2021 13:01:17 +0100 Subject: [PATCH] Adapt shell scripts that set up the environment for different shells Signed-off-by: Egbert Eich <eich@suse.com> Signed-off-by: Egbert Eich <eich@suse.de> --- share/spack/setup-env.csh | 5 +++- share/spack/setup-env.fish | 15 +--------- share/spack/setup-env.sh | 61 ++------------------------------------ 3 files changed, 7 insertions(+), 74 deletions(-) diff --git a/share/spack/setup-env.csh b/share/spack/setup-env.csh index ad20d346d1..91c48ecae9 100755 --- a/share/spack/setup-env.csh +++ b/share/spack/setup-env.csh @@ -12,6 +12,10 @@ # # prevent infinite recursion when spack shells out (e.g., on cray for modules) +if ($?SPACK_ROOT == 0) then + setenv SPACK_ROOT = @@_prefix@@ +endif + if ($?_sp_initializing) then exit 0 endif @@ -71,7 +75,6 @@ foreach cmd ("$SPACK_PYTHON" python3 python python2) end # Set variables needed by this script -_spack_pathadd PATH "$SPACK_ROOT/bin" eval `spack --print-shell-vars csh` # Set up module search paths in the user environment diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish index e00d8e76bb..961ec39015 100755 --- a/share/spack/setup-env.fish +++ b/share/spack/setup-env.fish @@ -671,12 +671,6 @@ end -# -# Figure out where this file is. Below code only needs to work in fish -# -set -l sp_source_file (status -f) # name of current file - - # # Identify and lock the python interpreter @@ -691,14 +685,7 @@ end -# -# Find root directory and add bin to path. -# -set -l sp_share_dir (realpath (dirname $sp_source_file)) -set -l sp_prefix (realpath (dirname (dirname $sp_share_dir))) -spack_pathadd PATH "$sp_prefix/bin" -set -xg SPACK_ROOT $sp_prefix - +set -xg SPACK_ROOT @@_prefix@@ # diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index d3a97d9af6..45195fb36f 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -249,64 +249,6 @@ _sp_shell=$(_spack_determine_shell) alias spacktivate="spack env activate" -# -# Figure out where this file is. -# -if [ "$_sp_shell" = bash ]; then - _sp_source_file="${BASH_SOURCE[0]:-}" -elif [ "$_sp_shell" = zsh ]; then - _sp_source_file="${(%):-%N}" -else - # Try to read the /proc filesystem (works on linux without lsof) - # In dash, the sourced file is the last one opened (and it's kept open) - _sp_source_file_fd="$(\ls /proc/$$/fd 2>/dev/null | sort -n | tail -1)" - if ! _sp_source_file="$(readlink /proc/$$/fd/$_sp_source_file_fd)"; then - # Last resort: try lsof. This works in dash on macos -- same reason. - # macos has lsof installed by default; some linux containers don't. - _sp_lsof_output="$(lsof -p $$ -Fn0 | tail -1)" - _sp_source_file="${_sp_lsof_output#*n}" - fi - - # If we can't find this script's path after all that, bail out with - # plain old $0, which WILL NOT work if this is sourced indirectly. - if [ ! -f "$_sp_source_file" ]; then - _sp_source_file="$0" - fi -fi - -# -# Find root directory and add bin to path. -# -# We send cd output to /dev/null to avoid because a lot of users set up -# their shell so that cd prints things out to the tty. -if [ "$_sp_shell" = zsh ]; then - _sp_share_dir="${_sp_source_file:A:h}" - _sp_prefix="${_sp_share_dir:h:h}" -else - _sp_share_dir="$(cd "$(dirname $_sp_source_file)" > /dev/null && pwd)" - _sp_prefix="$(cd "$(dirname $(dirname $_sp_share_dir))" > /dev/null && pwd)" -fi -if [ -x "$_sp_prefix/bin/spack" ]; then - export SPACK_ROOT="${_sp_prefix}" -else - # If the shell couldn't find the sourced script, fall back to - # whatever the user set SPACK_ROOT to. - if [ -n "$SPACK_ROOT" ]; then - _sp_prefix="$SPACK_ROOT" - _sp_share_dir="$_sp_prefix/share/spack" - fi - - # If SPACK_ROOT didn't work, fail. We should need this rarely, as - # the tricks above for finding the sourced file are pretty robust. - if [ ! -x "$_sp_prefix/bin/spack" ]; then - echo "==> Error: SPACK_ROOT must point to spack's prefix when using $_sp_shell" - echo "Run this with the correct prefix before sourcing setup-env.sh:" - echo " export SPACK_ROOT=</path/to/spack>" - return 1 - fi -fi -_spack_pathadd PATH "${_sp_prefix%/}/bin" - # # Check whether a function of the given name is defined # @@ -387,11 +329,12 @@ if [ -z "${SPACK_SKIP_MODULES+x}" ]; then } _sp_multi_pathadd MODULEPATH "$_sp_tcl_roots" fi +export SPACK_ROOT=@@_prefix@@ # Add programmable tab completion for Bash # if test "$_sp_shell" = bash || test -n "${ZSH_VERSION:-}"; then - source $_sp_share_dir/spack-completion.bash + source $SPACK_ROOT/share/spack/spack-completion.bash fi # done: unset sentinel variable as we're no longer initializing -- 2.40.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor