From 0677aba16a58d5a945ebb65fe1bf6ad6f78e6895 Mon Sep 17 00:00:00 2001
From: Swapnil Negi <swapnil.negi09@gmail.com>
Date: Fri, 23 Mar 2018 03:37:21 +0530
Subject: modtool: add option for copyrightholder

fixes #1587
---
 gr-utils/python/modtool/modtool_add.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'gr-utils/python/modtool/modtool_add.py')

diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py
index cc7e261c05..c21ae3dc2a 100644
--- a/gr-utils/python/modtool/modtool_add.py
+++ b/gr-utils/python/modtool/modtool_add.py
@@ -24,6 +24,7 @@ import os
 import re
 from optparse import OptionGroup
 import readline
+import getpass
 
 from util_functions import append_re_line_sequence, ask_yes_no, SequenceCompleter
 from cmakefile_editor import CMakeFileEditor
@@ -113,7 +114,16 @@ class ModToolAdd(ModTool):
         if not options.license_file:
             self._info['copyrightholder'] = options.copyright
             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'] = raw_input("Please specify the copyright holder: ")
+                    if not self._info['copyrightholder'] or self._info['copyrightholder'].isspace():
+                        self._info['copyrightholder'] = "gr-"+self._info['modname']+" author"
             elif self._info['is_component']:
                 print "For GNU Radio components the FSF is added as copyright holder"
         self._license_file = options.license_file
-- 
cgit v1.2.3