From 3111ccefcb562e7c64acd46366d49d2472ad9192 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Tue, 19 Jan 2016 11:02:31 +0100 Subject: [PATCH] Some doc on file generation --- python/dune/perftool/file.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/dune/perftool/file.py b/python/dune/perftool/file.py index d0e751d0..95b0bbe8 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) -- GitLab