diff --git a/python/dune/perftool/file.py b/python/dune/perftool/file.py index d0e751d0bab72d2afade66e0adee25f63a88380e..95b0bbe8d6679985c275a9f47b5eecc6febc1685 100644 --- a/python/dune/perftool/file.py +++ b/python/dune/perftool/file.py @@ -1,6 +1,5 @@ """ Manages the generation of C++ header files """ -from dune.perftool.generation import retrieve_cache_items def generate_file(filename, tag, content, headerguard=True): """ @@ -8,9 +7,18 @@ def generate_file(filename, tag, content, headerguard=True): Arguments: ---------- + filename : str + The filename to write the generated code to. + tag: str + The tag, that all entries related to this file in the cache have. + content: list + A list of Generables to put into the file. Keyword Arguments: ------------------ + headerguard : bool + Whether a double inclusion protection header should be added to the file. + The name of the macro is mangled from the absolute path. Defaults to True. """ with open(filename, 'w') as f: # Add a double inclusion protection header @@ -19,6 +27,7 @@ def generate_file(filename, tag, content, headerguard=True): f.write("#ifndef {0}\n#define {0}\n\n".format(macro)) # Add the includes from the cache + from dune.perftool.generation import retrieve_cache_items for inc in retrieve_cache_items((tag, 'include'), union=False): from cgen import Include assert isinstance(inc, Include)