Changed structure of class, add compiler strategy is a method and can create a dict

This commit is contained in:
Mario Melara 2015-10-21 11:32:59 -07:00
parent 9b387e7682
commit a89abb435f

View file

@ -48,19 +48,7 @@ class Architecture(object):
If it is on a Cray architecture it should look in modules. If it is anything else search $PATH. If it is on a Cray architecture it should look in modules. If it is anything else search $PATH.
""" """
def __init__(self, front=None, back=None): def add_compiler_strategy(self, front,back):
""" 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}
Takes in two parameters:
front = None defaults to None. Should be the front-end architecture of the machine
back = None defaults to None. Should be the back-end architecture of the machine
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 = []
names.append(front) names.append(front)
names.append(back) names.append(back)
@ -75,7 +63,20 @@ def _add_compiler_strategy(front,back):
d[n] = 'No Strategy' d[n] = 'No Strategy'
return d return d
self.arch_dict = _add_compiler_strategy(front, back) 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}
Takes in two parameters:
front = None defaults to None. Should be the front-end architecture of the machine
back = None defaults to None. Should be the back-end architecture of the machine
If no arguments are given it will return an empty dictionary
Uses the _add_compiler_strategy(front, back) to create the dictionary
"""
self.front = front
self.back = back
self.arch_dict = self.add_compiler_strategy(front, back)
def get_sys_type_from_spack_globals(): def get_sys_type_from_spack_globals():