summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMario Melara <maamelara@gmail.com>2015-10-21 11:32:59 -0700
committerMario Melara <maamelara@gmail.com>2015-10-21 11:32:59 -0700
commita89abb435f288c2864d9a21089b20f6eaac5d98b (patch)
tree3b0ee77cb274fc1494b723730747460e5bda6684 /lib
parent9b387e7682c22b74661e3363442adcfb569d8680 (diff)
downloadspack-a89abb435f288c2864d9a21089b20f6eaac5d98b.tar.gz
spack-a89abb435f288c2864d9a21089b20f6eaac5d98b.tar.bz2
spack-a89abb435f288c2864d9a21089b20f6eaac5d98b.tar.xz
spack-a89abb435f288c2864d9a21089b20f6eaac5d98b.zip
Changed structure of class, add compiler strategy is a method and can create a dict
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/architecture.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py
index 3968b82124..7c1bdfb20f 100644
--- a/lib/spack/spack/architecture.py
+++ b/lib/spack/spack/architecture.py
@@ -48,6 +48,21 @@ class Architecture(object):
If it is on a Cray architecture it should look in modules. If it is anything else search $PATH.
"""
+ def add_compiler_strategy(self, front,back):
+ names = []
+ names.append(front)
+ names.append(back)
+ d = {}
+ for n in names:
+ if n:
+ if 'cray' in n.lower():
+ d[n] = "MODULES"
+ elif 'linux' in n.lower():
+ d[n] = "PATH"
+ else:
+ d[n] = 'No Strategy'
+ return d
+
def __init__(self, front=None, back=None):
""" Constructor for the architecture class. It will create a list from the given arguments and iterate
through that list. It will then create a dictionary of {arch_name : strategy}
@@ -59,23 +74,9 @@ class Architecture(object):
If no arguments are given it will return an empty dictionary
Uses the _add_compiler_strategy(front, back) to create the dictionary
"""
-
- def _add_compiler_strategy(front,back):
- names = []
- names.append(front)
- names.append(back)
- d = {}
- for n in names:
- if n:
- if 'cray' in n.lower():
- d[n] = "MODULES"
- elif 'linux' in n.lower():
- d[n] = "PATH"
- else:
- d[n] = 'No Strategy'
- return d
-
- self.arch_dict = _add_compiler_strategy(front, back)
+ self.front = front
+ self.back = back
+ self.arch_dict = self.add_compiler_strategy(front, back)
def get_sys_type_from_spack_globals():