Source code for mojo.libdist.BuildConfiguration

"""
BuildConfiguration
==================
Contains class "BuildConfiguration" which is used for saving the build configuration
of one set from the XML file
You have three methods to add macros, make commands and modules to the object
the __str__ method is overwritten, so you can print the object
"""


[docs]class BuildConfiguration: """ Contains specification for one build configuration set fromm the XML file. :param name: name of the buildConfiguration :type name: string """ def __init__(self, name): """stores build configuration name :param name: name of the build configuration :type name: string """ # list of MacroChangeSet self.macroChangeSets = [] # list of string , options to make command (ex. SCOUT=yes) self.makeCommands = [] # list of module names (ex. openmpi-1.4.3) self.modules = {} # name of build configuration, read from XML self.name = name def __str__(self): """ Print all informations stored in the object. :return: all information stored in build configuration :rtype: string """ return ("Build Configuration\n\n" f"Name: {self.name}\n" f"Modules: {self.modules}\n" f"Make commands: {self.makeCommands}\n" f"Macros: {self.macroChangeSets}" )
[docs] def addMacroChangeSet(self, macro): """appends macro to list of macro change sets for project :param macro: tuple consist of headerPath variableName and value, e.g. ('trace/traceControl.h','DOUBLE_PRECISION','ON') :type macro: tuple """ self.macroChangeSets.append(macro)
[docs] def addMakeCommand(self, command): """appends make command to list of make commands for project :param command: make command line option :type command: string """ self.makeCommands.append(command)
[docs] def addModules(self, key, module): """append module to list of modules for project :param key: name of the module :param module: module which will be loaded :type key: string :type module: string """ self.modules[key] = module