variables
Module that contains a set of classes and function to generate variables to be used e.g., in compiling or linking
Authors:
- Stijn De Weirdt (Ghent University)
- Kenneth Hoste (Ghent University)
AbsPathList
¶
Bases: StrList
Absolute paths (eg -L or -I)
append_exists(prefix, paths, suffix=None, filename=None, append_all=False)
¶
Given prefix and list of paths, return first that exists if suffix : extend the paths with prefixes if filename : look for filename in prefix+paths
append_subdirs(base, subdirs=None)
¶
Add directory base, or its subdirs if subdirs is not None
ListOfLists
¶
Bases: list
List of lists
append_empty()
¶
Initialise MAP_CLASS instance
copy()
¶
Return copy of self
get_first()
¶
Return first non-empty list if it doesn't exist, try to return first element
nappend(value, **kwargs)
¶
Named append name is not used anymore
nextend(value=None, **kwargs)
¶
Named extend, value is list type (TODO: tighten the allowed values) name not used anymore
sanitize()
¶
Cleanup self
show_el()
¶
Show some info on the elements
str_convert(x)
¶
Given x, return a string representing x called in str of this class
try_function_on_element(function_name, names=None, args=None, kwargs=None)
¶
Try to run function function_name on each element
try_remove(values)
¶
Try to remove one or more values from the elements
StrList
¶
Bases: list
List of strings
__getattribute__(attr_name)
¶
Filter out function calls from Variables class
__str__()
¶
_str_self and support for BEGIN/END
copy()
¶
Return copy of self
sanitize()
¶
Sanitize self
str_convert(x)
¶
Convert members of list to string (no prefix of begin and end)
try_remove(values)
¶
Remove without ValueError in case of missing element
Variables
¶
Bases: dict
Class to hold variable-like key/value pairs All values are lists (or derived from list class) most only have a single element though some are lists of lists str creates a single string
Most items are of same DEFAULT_CLASS
but are in different classes
__setitem__(name, value)
¶
Automatically creates a list for each name
append(name, value)
¶
Append value to element name (alias for nappend)
get_element_class(name)
¶
Return the class associated with the name according to the DEFAULT_CLASS and MAP_CLASS
get_instance(name=None)
¶
Return an instance of the class
get_list_class(name)
¶
Return the class associated with the name according to the DEFAULT_LISTCLASS and MAP_LISTCLASS
join(name, *others)
¶
Join all values in others into name it is first tested if other is an existing element else it is nappend-ed
try_function_on_element(function_name, names=None, args=None, kwargs=None)
¶
Try to run function function_name on each element of names
get_class(name, default_class, map_class=None)
¶
Return class based on default map_class if key == str -> value = class else: key = class -> list of strings
join_map_class(map_classes)
¶
Join all class_maps into single class_map