diff options
author | Josh Morman <mormjb@gmail.com> | 2020-01-14 11:58:31 -0500 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2020-01-24 23:49:10 -0800 |
commit | 2f8c0092ae0ac25387e0f9b7e36c8850d3d64229 (patch) | |
tree | 282b97fe24db2b842313905bdf5dcfd9562f85df /gr-utils/python | |
parent | a11d2e36c63a3011ab2b3407798b766068e31d8f (diff) |
blocktool: add include paths option
Diffstat (limited to 'gr-utils/python')
-rw-r--r-- | gr-utils/python/blocktool/cli.py | 2 | ||||
-rw-r--r-- | gr-utils/python/blocktool/core/base.py | 2 | ||||
-rw-r--r-- | gr-utils/python/blocktool/core/parseheader.py | 5 |
3 files changed, 7 insertions, 2 deletions
diff --git a/gr-utils/python/blocktool/cli.py b/gr-utils/python/blocktool/cli.py index dbb7b7cbc5..a68c6e1676 100644 --- a/gr-utils/python/blocktool/cli.py +++ b/gr-utils/python/blocktool/cli.py @@ -66,6 +66,8 @@ def run_blocktool(module): help='blocktool helper comments will be added in the header file') @click.option('-o', '--output', is_flag=True, help='If given, a file with desired output format will be generated') +@click.option('-I', '--include_paths', default=None, + help='Comma separated list of include paths for header files') def cli(**kwargs): """ Block header parsing tool. diff --git a/gr-utils/python/blocktool/core/base.py b/gr-utils/python/blocktool/core/base.py index 5e62835e12..8632171c90 100644 --- a/gr-utils/python/blocktool/core/base.py +++ b/gr-utils/python/blocktool/core/base.py @@ -39,7 +39,7 @@ class BlockTool(ABC): def __init__(self, modname=None, filename=None, targetdir=None, target_file=None, module=None, impldir=None, impl_file=None, - yaml=False, json=False, **kwargs): + yaml=False, json=False, include_paths=None, **kwargs): """ __init__ """ pass diff --git a/gr-utils/python/blocktool/core/parseheader.py b/gr-utils/python/blocktool/core/parseheader.py index 7b1e743554..2ff4378fe6 100644 --- a/gr-utils/python/blocktool/core/parseheader.py +++ b/gr-utils/python/blocktool/core/parseheader.py @@ -51,11 +51,13 @@ class BlockHeaderParser(BlockTool): name = 'Block Parse Header' description = 'Create a parsed output from a block header file' - def __init__(self, file_path=None, blocktool_comments=False, **kwargs): + def __init__(self, file_path=None, blocktool_comments=False, include_paths=None, **kwargs): """ __init__ """ BlockTool.__init__(self, **kwargs) self.parsed_data = {} self.addcomments = blocktool_comments + if (include_paths): + self.include_paths = [p.strip() for p in include_paths.split(',')] if not os.path.isfile(file_path): raise BlockToolException('file does not exist') file_path = os.path.abspath(file_path) @@ -104,6 +106,7 @@ class BlockHeaderParser(BlockTool): xml_generator_config = parser.xml_generator_configuration_t( xml_generator_path=generator_path, xml_generator=generator_name, + include_paths=self.include_paths, compiler='gcc') decls = parser.parse( [self.target_file], xml_generator_config) |