summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/spack-python2
-rw-r--r--bin/spack.bat28
-rw-r--r--bin/spack.ps12
-rw-r--r--bin/spack_cmd.bat66
4 files changed, 21 insertions, 77 deletions
diff --git a/bin/spack-python b/bin/spack-python
index ff555aa93b..b8e76f826b 100755
--- a/bin/spack-python
+++ b/bin/spack-python
@@ -22,4 +22,4 @@
#
# This is compatible across platforms.
#
-exec /usr/bin/env spack python "$@"
+exec spack python "$@"
diff --git a/bin/spack.bat b/bin/spack.bat
index 8328013599..a5a5384e9f 100644
--- a/bin/spack.bat
+++ b/bin/spack.bat
@@ -188,25 +188,27 @@ if NOT "%_sp_args%"=="%_sp_args:--help=%" (
goto :end_switch
:case_load
-:: If args contain --sh, --csh, or -h/--help: just execute.
-if defined _sp_args (
- if NOT "%_sp_args%"=="%_sp_args:--help=%" (
- goto :default_case
- ) else if NOT "%_sp_args%"=="%_sp_args:-h=%" (
- goto :default_case
- ) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" (
- goto :default_case
- )
+if NOT defined _sp_args (
+ exit /B 0
+)
+
+:: If args contain --bat, or -h/--help: just execute.
+if NOT "%_sp_args%"=="%_sp_args:--help=%" (
+ goto :default_case
+) else if NOT "%_sp_args%"=="%_sp_args:-h=%" (
+ goto :default_case
+) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" (
+ goto :default_case
+) else if NOT "%_sp_args%"=="%_sp_args:--list=%" (
+ goto :default_case
)
for /f "tokens=* USEBACKQ" %%I in (
- `python "%spack%" %_sp_flags% %_sp_subcommand% --bat %_sp_args%`) do %%I
+ `python "%spack%" %_sp_flags% %_sp_subcommand% --bat %_sp_args%`
+ ) do %%I
goto :end_switch
-:case_unload
-goto :case_load
-
:default_case
python "%spack%" %_sp_flags% %_sp_subcommand% %_sp_args%
goto :end_switch
diff --git a/bin/spack.ps1 b/bin/spack.ps1
index 5a82b0b620..1ceeb0a250 100644
--- a/bin/spack.ps1
+++ b/bin/spack.ps1
@@ -144,3 +144,5 @@ switch($SpackSubCommand)
"unload" {Invoke-SpackLoad}
default {python "$Env:SPACK_ROOT/bin/spack" $SpackCMD_params $SpackSubCommand $SpackSubCommandArgs}
}
+
+exit $LASTEXITCODE
diff --git a/bin/spack_cmd.bat b/bin/spack_cmd.bat
index 392e42d29b..da7b67e3bc 100644
--- a/bin/spack_cmd.bat
+++ b/bin/spack_cmd.bat
@@ -1,71 +1,11 @@
@ECHO OFF
-setlocal EnableDelayedExpansion
:: (c) 2021 Lawrence Livermore National Laboratory
:: To use this file independently of Spack's installer, execute this script in its directory, or add the
:: associated bin directory to your PATH. Invoke to launch Spack Shell.
::
:: source_dir/spack/bin/spack_cmd.bat
::
-pushd %~dp0..
-set SPACK_ROOT=%CD%
-pushd %CD%\..
-set spackinstdir=%CD%
-popd
-
-:: Check if Python is on the PATH
-if not defined python_pf_ver (
-(for /f "delims=" %%F in ('where python.exe') do (
- set "python_pf_ver=%%F"
- goto :found_python
- ) ) 2> NUL
-)
-:found_python
-if not defined python_pf_ver (
- :: If not, look for Python from the Spack installer
- :get_builtin
- (for /f "tokens=*" %%g in ('dir /b /a:d "!spackinstdir!\Python*"') do (
- set "python_ver=%%g")) 2> NUL
-
- if not defined python_ver (
- echo Python was not found on your system.
- echo Please install Python or add Python to your PATH.
- ) else (
- set "py_path=!spackinstdir!\!python_ver!"
- set "py_exe=!py_path!\python.exe"
- )
- goto :exitpoint
-) else (
- :: Python is already on the path
- set "py_exe=!python_pf_ver!"
- (for /F "tokens=* USEBACKQ" %%F in (
- `"!py_exe!" --version`) do (set "output=%%F")) 2>NUL
- if not "!output:Microsoft Store=!"=="!output!" goto :get_builtin
- goto :exitpoint
-)
-:exitpoint
-
-set "PATH=%SPACK_ROOT%\bin\;%PATH%"
-if defined py_path (
- set "PATH=%py_path%;%PATH%"
-)
-
-if defined py_exe (
- "%py_exe%" "%SPACK_ROOT%\bin\haspywin.py"
-)
-
-set "EDITOR=notepad"
-
-DOSKEY spacktivate=spack env activate $*
-
-@echo **********************************************************************
-@echo ** Spack Package Manager
-@echo **********************************************************************
-
-IF "%1"=="" GOTO CONTINUE
-set
-GOTO:EOF
-
-:continue
-set PROMPT=[spack] %PROMPT%
-%comspec% /k
+call "%~dp0..\share\spack\setup-env.bat"
+pushd %SPACK_ROOT%
+%comspec% /K