diff options
author | Swapnil Negi <swapnil.negi09@gmail.com> | 2019-01-04 18:29:50 +0100 |
---|---|---|
committer | Andrej Rode <mail@andrejro.de> | 2019-01-04 18:58:02 +0100 |
commit | 055287896c8c97eb0cdda825559e217d8db54a14 (patch) | |
tree | 613262f5ed45ba4eaadf1bd76009aa16ad22806f /gr-utils/python/utils/gr_modtool | |
parent | 2fcf3b8afe51092003b7f916edb9e5d6372d4842 (diff) |
modtool: gr-modtool overhaul GSoC 2018
This commit contains all the changes done during the 2018 GSoC
"gr-modtool overhaul".
Changes include:
- Rewrite of gr-modtool based on Python Click
- Split of gr-modtool in cli and core
- Adherence to new GNU Radio 3.8 API for OOTs
- Pylint improvements
- Py3k and Py2k compatibility
This feature is merged in a squash-merge due to big refactoring
on the head and base branch and the impossibility to unclutter both.
Diffstat (limited to 'gr-utils/python/utils/gr_modtool')
-rwxr-xr-x | gr-utils/python/utils/gr_modtool | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/gr-utils/python/utils/gr_modtool b/gr-utils/python/utils/gr_modtool index f959c91f66..4f2738901e 100755 --- a/gr-utils/python/utils/gr_modtool +++ b/gr-utils/python/utils/gr_modtool @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2012 Free Software Foundation, Inc. +# Copyright 2012, 2018 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,39 +21,12 @@ # """ A tool for editing GNU Radio out-of-tree modules. """ -from __future__ import print_function -from gnuradio.modtool import * +from gnuradio.modtool.cli.base import cli -def setup_parser(): - modules = get_modtool_modules(ModTool.__subclasses__()) - parser = ModTool.get_parser() - subparsers = parser.add_subparsers(title="Commands") - epilog = [] - for module in modules: - subparser = subparsers.add_parser(module.name, - description=module.description) - module.setup_parser(subparser) - subparser.set_defaults(module=module) - epilog.append(" {:<22}{}".format(module.name, module.description)) - parser.epilog = '\n'.join(epilog) - return parser - -def main(): - """ Here we go. Parse command, choose class and run. """ - parser = setup_parser() - args = parser.parse_args() - - try: - args.module().run(args) - except ModToolException as err: - print(err, file=sys.stderr) - exit(1) - if __name__ == '__main__': try: - main() + cli() except KeyboardInterrupt: pass - |