diff options
Diffstat (limited to 'gr-utils/python')
-rw-r--r-- | gr-utils/python/modtool/cli/add.py | 12 | ||||
-rw-r--r-- | gr-utils/python/modtool/tools/scm.py | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gr-utils/python/modtool/cli/add.py b/gr-utils/python/modtool/cli/add.py index 45f749c375..fcc2ff539b 100644 --- a/gr-utils/python/modtool/cli/add.py +++ b/gr-utils/python/modtool/cli/add.py @@ -25,6 +25,7 @@ from __future__ import absolute_import from __future__ import unicode_literals import re +import getpass import click @@ -109,7 +110,16 @@ def get_blockname(self): def get_copyrightholder(self): """ Get the copyrightholder of the block to be added """ if self.info['copyrightholder'] is None: - self.info['copyrightholder'] = '<+YOU OR YOUR COMPANY+>' + user = getpass.getuser() + git_user = self.scm.get_gituser() + if git_user: + copyright_candidates = (user, git_user, 'GNU Radio') + else: + copyright_candidates = (user, 'GNU Radio') + with SequenceCompleter(copyright_candidates): + self.info['copyrightholder'] = cli_input("Please specify the copyright holder: ") + if not self.info['copyrightholder'] or self.info['copyrightholder'].isspace(): + self.info['copyrightholder'] = "gr-{} author".format(self.info['modname']) elif self.info['is_component']: click.secho("For GNU Radio components the FSF is added as copyright holder", fg='cyan') diff --git a/gr-utils/python/modtool/tools/scm.py b/gr-utils/python/modtool/tools/scm.py index 249616ade3..c91f891123 100644 --- a/gr-utils/python/modtool/tools/scm.py +++ b/gr-utils/python/modtool/tools/scm.py @@ -91,7 +91,7 @@ class SCMRepository(object): def get_gituser(self): """ Gets the git user """ try: - return subprocess.check_output('git config --global user.name', shell=True).strip() + return (subprocess.check_output('git config --global user.name', shell=True).strip()).decode('utf-8') except (OSError, subprocess.CalledProcessError): return None |