diff options
author | Josh Morman <mormjb@gmail.com> | 2020-03-16 14:47:07 -0400 |
---|---|---|
committer | mormj <34754695+mormj@users.noreply.github.com> | 2020-03-31 18:22:44 -0400 |
commit | 82262753a56d15cfa6343044c726cf0035c38d9c (patch) | |
tree | 9b2edf83155e854f374cf8ccbb14bd5003b61794 /gr-utils/python | |
parent | 82271c56176b0bb526150efa501120711ce00767 (diff) |
modtool: use prefix path for modtool instead of prefs
When a prefix gets installed, the [modtool] section in prefs hardcodes
the path to the templates in the newly installed prefix as a global path
for all modtools. This creates major problems when bouncing between
prefixes, especially when newmod changes between releases
Why not just use the prefix as the root of where to look for the
templates
Diffstat (limited to 'gr-utils/python')
-rw-r--r-- | gr-utils/python/modtool/cli/newmod.py | 4 | ||||
-rw-r--r-- | gr-utils/python/modtool/core/newmod.py | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/gr-utils/python/modtool/cli/newmod.py b/gr-utils/python/modtool/cli/newmod.py index 6082fb7beb..cdb4b56cfb 100644 --- a/gr-utils/python/modtool/cli/newmod.py +++ b/gr-utils/python/modtool/cli/newmod.py @@ -21,7 +21,6 @@ from gnuradio import gr from ..core import ModToolNewModule from .base import common_params, run, cli_input, ModToolException - @click.command('newmod', short_help=ModToolNewModule.description) @click.option('--srcdir', help="Source directory for the module template.") @@ -45,8 +44,7 @@ def cli(**kwargs): else: raise ModToolException('The given directory exists.') if self.srcdir is None: - self.srcdir = '/usr/local/share/gnuradio/modtool/templates/gr-newmod' - self.srcdir = gr.prefs().get_string('modtool', 'newmod_path', self.srcdir) + self.srcdir = os.path.join(gr.prefix(),'share','gnuradio','modtool','templates','gr-newmod') if not os.path.isdir(self.srcdir): raise ModToolException('Could not find gr-newmod source dir.') run(self) diff --git a/gr-utils/python/modtool/core/newmod.py b/gr-utils/python/modtool/core/newmod.py index 4ceae70b24..1d22626e10 100644 --- a/gr-utils/python/modtool/core/newmod.py +++ b/gr-utils/python/modtool/core/newmod.py @@ -23,7 +23,6 @@ from .base import ModTool, ModToolException logger = logging.getLogger(__name__) - class ModToolNewModule(ModTool): """ Create a new out-of-tree module """ name = 'newmod' @@ -37,8 +36,7 @@ class ModToolNewModule(ModTool): def assign(self): self.dir = os.path.join(self.directory, 'gr-{}'.format(self.info['modname'])) if self.srcdir is None: - self.srcdir = '/usr/local/share/gnuradio/modtool/templates/gr-newmod' - self.srcdir = gr.prefs().get_string('modtool', 'newmod_path', self.srcdir) + self.srcdir = os.path.join(gr.prefix(),'share','gnuradio','modtool','templates','gr-newmod') def validate(self): """ Validates the arguments """ |