From fcfe2618d50b39e8991685dc2f42f1495951da7e Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Wed, 13 Jul 2016 20:33:14 +0200 Subject: Improve shell integration. Enable sh emulation for Zsh and allow loading modules recursively. --- share/spack/setup-env.sh | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'share') diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index 8aa259cf15..c5245add5e 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -57,6 +57,11 @@ ######################################################################## function spack { + # Zsh does not do word splitting by default, this enables it for this function only + if [ -n "$ZSH_VERSION" ]; then + emulate -L sh + fi + # save raw arguments into an array before butchering them args=( "$@" ) @@ -93,11 +98,18 @@ function spack { ;; "use"|"unuse"|"load"|"unload") # Shift any other args for use off before parsing spec. + _sp_subcommand_args="" _sp_module_args="" - if [[ "$1" =~ ^- ]]; then - _sp_module_args="$1"; shift - _sp_spec="$@" - fi + while [[ "$1" =~ ^- ]]; do + if [ "$1" = "-r" ]; then + _sp_subcommand_args="$_sp_subcommand_args $1" + else + _sp_module_args="$_sp_module_args $1" + fi + shift + done + + _sp_spec="$@" # Here the user has run use or unuse with a spec. Find a matching # spec using 'spack module find', then use the appropriate module @@ -105,19 +117,19 @@ function spack { # If spack module command comes back with an error, do nothing. case $_sp_subcommand in "use") - if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then + if _sp_full_spec=$(command spack $_sp_flags module find $_sp_subcommand_args dotkit $_sp_spec); then use $_sp_module_args $_sp_full_spec fi ;; "unuse") - if _sp_full_spec=$(command spack $_sp_flags module find dotkit $_sp_spec); then + if _sp_full_spec=$(command spack $_sp_flags module find $_sp_subcommand_args dotkit $_sp_spec); then unuse $_sp_module_args $_sp_full_spec fi ;; "load") - if _sp_full_spec=$(command spack $_sp_flags module find tcl $_sp_spec); then + if _sp_full_spec=$(command spack $_sp_flags module find $_sp_subcommand_args tcl $_sp_spec); then module load $_sp_module_args $_sp_full_spec fi ;; "unload") - if _sp_full_spec=$(command spack $_sp_flags module find tcl $_sp_spec); then + if _sp_full_spec=$(command spack $_sp_flags module find $_sp_subcommand_args tcl $_sp_spec); then module unload $_sp_module_args $_sp_full_spec fi ;; esac -- cgit v1.2.3-70-g09d2 From 64d91943ec3773a539ef39be4e9ab5ab132df01a Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Thu, 14 Jul 2016 20:14:06 +0200 Subject: Support --dependencies for recursively loading modules. --- share/spack/setup-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share') diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index c5245add5e..19206255db 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -101,7 +101,7 @@ function spack { _sp_subcommand_args="" _sp_module_args="" while [[ "$1" =~ ^- ]]; do - if [ "$1" = "-r" ]; then + if [ "$1" = "-r" -o "$1" = "--dependencies" ]; then _sp_subcommand_args="$_sp_subcommand_args $1" else _sp_module_args="$_sp_module_args $1" -- cgit v1.2.3-70-g09d2 From a4a2f179c712df806f12e0904d1d3eddcd54dfef Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 15 Jul 2016 12:11:41 -0500 Subject: Updates to run-flake8 test --- share/spack/qa/run-flake8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'share') diff --git a/share/spack/qa/run-flake8 b/share/spack/qa/run-flake8 index 57534eb6e2..595df417ec 100755 --- a/share/spack/qa/run-flake8 +++ b/share/spack/qa/run-flake8 @@ -18,7 +18,7 @@ if [[ ! $flake8 ]]; then fi # Check if changed files are flake8 conformant [framework] -changed=$(git diff --name-only develop... | grep '.py$') +changed=$(git diff --name-only --find-renames develop... | grep '.py$') # Add approved style exemptions to the changed packages. for file in $changed; do @@ -26,6 +26,7 @@ for file in $changed; do cp "$file" "$file~" # Exempt lines with urls and descriptions from overlong line errors. + perl -i -pe 's/^(\s*homepage\s*=.*)$/\1 # NOQA: ignore=E501/' $file perl -i -pe 's/^(\s*url\s*=.*)$/\1 # NOQA: ignore=E501/' $file perl -i -pe 's/^(\s*version\(.*\).*)$/\1 # NOQA: ignore=E501/' $file perl -i -pe 's/^(\s*variant\(.*\).*)$/\1 # NOQA: ignore=E501/' $file -- cgit v1.2.3-70-g09d2