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/gr-newmod/CMakeLists.txt             |  3 ++-
 gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt        |  3 ++-
 .../python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake |  3 ++-
 .../python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake  |  3 ++-
 .../python/modtool/gr-newmod/cmake/Modules/GrPython.cmake    |  3 ++-
 gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake |  3 ++-
 gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake |  3 ++-
 gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt        |  3 ++-
 .../python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt     |  3 ++-
 .../modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py       |  3 ++-
 .../python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py    |  3 ++-
 .../modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py      |  3 ++-
 .../python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py    |  3 ++-
 gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py   |  3 ++-
 gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt         |  3 ++-
 .../python/modtool/gr-newmod/include/howto/CMakeLists.txt    |  3 ++-
 gr-utils/python/modtool/gr-newmod/include/howto/api.h        |  3 ++-
 gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt         |  3 ++-
 gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc            |  3 ++-
 gr-utils/python/modtool/gr-newmod/lib/qa_howto.h             |  3 ++-
 gr-utils/python/modtool/gr-newmod/lib/test_howto.cc          |  3 ++-
 gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt      |  3 ++-
 gr-utils/python/modtool/gr-newmod/python/build_utils.py      |  3 ++-
 .../python/modtool/gr-newmod/python/build_utils_codes.py     |  3 ++-
 gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt        |  3 ++-
 gr-utils/python/modtool/modtool_add.py                       | 12 +++++++++++-
 gr-utils/python/modtool/scm.py                               |  7 +++++++
 27 files changed, 68 insertions(+), 26 deletions(-)

(limited to 'gr-utils/python')

diff --git a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
index 3f316a78b4..30540c124e 100644
--- a/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011,2012,2014,2016 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt
index c837d77f67..e92732f65f 100644
--- a/gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/apps/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
index 426fcfcf29..18b0e82565 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
@@ -1,6 +1,7 @@
 # Copyright 2010-2011,2014 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake
index 00a53d04d9..ed9fc82580 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPlatform.cmake
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
index 06e061e212..c7b4027971 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
@@ -1,6 +1,7 @@
 # Copyright 2010-2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
index 04798b08e7..a1309aa61f 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
@@ -1,6 +1,7 @@
 # Copyright 2010-2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake
index 62caab4b51..186e2d5333 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrTest.cmake
@@ -1,6 +1,7 @@
 # Copyright 2010-2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt
index f16fbf6db4..8c86a96fc2 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/docs/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt
index 1b4479929b..7aa31fcecd 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
index 5cd0b3c6c5..b4b10a1765 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2010 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
index e8f026ab90..295eae4965 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2010 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
index 78e8153768..db73852865 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2010 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
index 629edd180d..ce0999f191 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2010 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
index d3536db8d0..9079a33c4f 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2010-2012 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt
index d776de7523..b0ce5e79a9 100644
--- a/gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/grc/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt
index 1cfb5a6eac..664ca26a34 100644
--- a/gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/include/howto/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011,2012 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/include/howto/api.h b/gr-utils/python/modtool/gr-newmod/include/howto/api.h
index db5f81f394..03620be2df 100644
--- a/gr-utils/python/modtool/gr-newmod/include/howto/api.h
+++ b/gr-utils/python/modtool/gr-newmod/include/howto/api.h
@@ -1,7 +1,8 @@
 /*
  * Copyright 2011 Free Software Foundation, Inc.
  *
- * This file is part of GNU Radio
+ * This file was generated by gr_modtool, a tool from the GNU Radio framework
+ * This file is a part of gr-howto
  *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt
index 10a15b7dd9..e932a95e48 100644
--- a/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/lib/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011,2012,2016 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc
index f86aed4aa1..2f10a3a564 100644
--- a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc
+++ b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.cc
@@ -1,7 +1,8 @@
 /*
  * Copyright 2012 Free Software Foundation, Inc.
  *
- * This file is part of GNU Radio
+ * This file was generated by gr_modtool, a tool from the GNU Radio framework
+ * This file is a part of gr-howto
  *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h
index 23f0f7f33e..c50bde3ec7 100644
--- a/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h
+++ b/gr-utils/python/modtool/gr-newmod/lib/qa_howto.h
@@ -2,7 +2,8 @@
 /*
  * Copyright 2012 Free Software Foundation, Inc.
  *
- * This file is part of GNU Radio
+ * This file was generated by gr_modtool, a tool from the GNU Radio framework
+ * This file is a part of gr-howto
  *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc
index cc89dc90f3..699bb5b640 100644
--- a/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc
+++ b/gr-utils/python/modtool/gr-newmod/lib/test_howto.cc
@@ -2,7 +2,8 @@
 /*
  * Copyright 2012 Free Software Foundation, Inc.
  *
- * This file is part of GNU Radio
+ * This file was generated by gr_modtool, a tool from the GNU Radio framework
+ * This file is a part of gr-howto
  *
  * GNU Radio is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt
index 9901854c8f..4b5303cc6f 100644
--- a/gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/python/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils.py b/gr-utils/python/modtool/gr-newmod/python/build_utils.py
index cf58a97637..a907101a75 100644
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils.py
+++ b/gr-utils/python/modtool/gr-newmod/python/build_utils.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2004,2009,2012 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
index 9ea96baae4..88bff95685 100644
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
+++ b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
@@ -1,7 +1,8 @@
 #
 # Copyright 2004 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt
index 5810b6c1ea..bc11347447 100644
--- a/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt
+++ b/gr-utils/python/modtool/gr-newmod/swig/CMakeLists.txt
@@ -1,6 +1,7 @@
 # Copyright 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Radio
+# This file was generated by gr_modtool, a tool from the GNU Radio framework
+# This file is a part of gr-howto
 #
 # GNU Radio is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
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
diff --git a/gr-utils/python/modtool/scm.py b/gr-utils/python/modtool/scm.py
index 9b0ef7db5e..aa4f94d531 100644
--- a/gr-utils/python/modtool/scm.py
+++ b/gr-utils/python/modtool/scm.py
@@ -81,6 +81,13 @@ class SCMRepository(object):
         """ Returns true if this repository manager is operating on an active, source-controlled directory. """
         return self.is_empty
 
+    def get_gituser(self):
+        """ Gets the git user """
+        try:
+            return subprocess.check_output('git config --global user.name', shell=True).strip()
+        except (OSError, subprocess.CalledProcessError):
+            return None
+
 
 ### Git #####################################################################
 class GitManagerGitPython(object):
-- 
cgit v1.2.3