summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-12-19 20:59:13 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-12-19 20:59:13 -0800
commit9edba1848968ce6539e6c3ee51fe56180f02ada8 (patch)
treea2e4e9b0db3bbf436283fd0184c12339e8d1ff77
parent53cb7e828bdfd83a99e44e2c36bdf9219b941143 (diff)
parent527154e6dfa0c9e5f35aed56adad3279bac4eac3 (diff)
downloadspack-9edba1848968ce6539e6c3ee51fe56180f02ada8.tar.gz
spack-9edba1848968ce6539e6c3ee51fe56180f02ada8.tar.bz2
spack-9edba1848968ce6539e6c3ee51fe56180f02ada8.tar.xz
spack-9edba1848968ce6539e6c3ee51fe56180f02ada8.zip
Merge pull request #230 from nolta/fix-env-mod-sys-type
fix environment module path when $SYS_TYPE isn't defined
-rw-r--r--lib/spack/spack/cmd/python.py10
-rwxr-xr-xshare/spack/setup-env.sh8
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/spack/spack/cmd/python.py b/lib/spack/spack/cmd/python.py
index e26b8d3e79..5325e8fd9a 100644
--- a/lib/spack/spack/cmd/python.py
+++ b/lib/spack/spack/cmd/python.py
@@ -32,13 +32,16 @@ import spack
def setup_parser(subparser):
subparser.add_argument(
+ '-c', dest='python_command', help='Command to execute.')
+ subparser.add_argument(
'python_args', nargs=argparse.REMAINDER, help="File to run plus arguments.")
description = "Launch an interpreter as spack would launch a command"
def python(parser, args):
# Fake a main python shell by setting __name__ to __main__.
- console = code.InteractiveConsole({'__name__' : '__main__'})
+ console = code.InteractiveConsole({'__name__' : '__main__',
+ 'spack' : spack})
if "PYTHONSTARTUP" in os.environ:
startup_file = os.environ["PYTHONSTARTUP"]
@@ -47,7 +50,10 @@ def python(parser, args):
console.runsource(startup.read(), startup_file, 'exec')
python_args = args.python_args
- if python_args:
+ python_command = args.python_command
+ if python_command:
+ console.runsource(python_command)
+ elif python_args:
sys.argv = python_args
with open(python_args[0]) as file:
console.runsource(file.read(), python_args[0], 'exec')
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh
index 5b03aa8955..47202f6087 100755
--- a/share/spack/setup-env.sh
+++ b/share/spack/setup-env.sh
@@ -173,8 +173,8 @@ fi
#
_sp_share_dir=$(cd "$(dirname $_sp_source_file)" && pwd)
_sp_prefix=$(cd "$(dirname $(dirname $_sp_share_dir))" && pwd)
-
-# TODO: fix SYS_TYPE to something non-LLNL-specific
-_spack_pathadd DK_NODE "${_sp_share_dir%/}/dotkit/$SYS_TYPE"
-_spack_pathadd MODULEPATH "${_sp_share_dir%/}/modules/$SYS_TYPE"
_spack_pathadd PATH "${_sp_prefix%/}/bin"
+
+_sp_sys_type=$(spack-python -c 'print(spack.architecture.sys_type())')
+_spack_pathadd DK_NODE "${_sp_share_dir%/}/dotkit/$_sp_sys_type"
+_spack_pathadd MODULEPATH "${_sp_share_dir%/}/modules/$_sp_sys_type"