diff options
author | Steve 'Ashcrow' Milner <stevem@gnulinux.net> | 2008-01-20 20:10:09 -0500 |
---|---|---|
committer | Steve 'Ashcrow' Milner <stevem@gnulinux.net> | 2008-01-20 20:10:09 -0500 |
commit | beba6363a0d81196f8ccc5d5a84084447e5c09d7 (patch) | |
tree | 6fd55c85e2687c4bf1599bc3bdf4246fe82d25a4 /scripts | |
parent | 03ae1fa69c8c364be9aca2ac5eb1745383c8910d (diff) | |
download | func-beba6363a0d81196f8ccc5d5a84084447e5c09d7.tar.gz func-beba6363a0d81196f8ccc5d5a84084447e5c09d7.tar.xz func-beba6363a0d81196f8ccc5d5a84084447e5c09d7.zip |
Added in copyright and traditional comment header for new modules.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/func-create-module | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/scripts/func-create-module b/scripts/func-create-module index cf05449..f2885e8 100755 --- a/scripts/func-create-module +++ b/scripts/func-create-module @@ -1,4 +1,6 @@ #!/usr/bin/env python +# +# Copyright 2008, Red Hat, Inc # Steve 'Ashcrow' Milner <smilner@redhat.com> # John Eckersberg <jeckersb@redhat.com> # @@ -10,6 +12,17 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. TEMPLATE = """\ +# +# Copyright %s +# %s <%s> +# +# This software may be freely redistributed under the terms of the GNU +# general public license. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + import func_module class %s(func_module.FuncModule): @@ -32,19 +45,24 @@ METHOD_TEMPLATE = '''\ ''' -def populate_template(module_name, desc, methods): +def populate_template(author_name, author_email, module_name, desc, methods): """ Makes the method strings and populates the template. """ + from datetime import datetime + actual_methods = "" for method in methods: actual_methods += METHOD_TEMPLATE % method - return TEMPLATE % (module_name, desc, actual_methods[:-2]) + return TEMPLATE % (datetime.now().strftime("%Y"), author_name, + author_email, module_name, desc, actual_methods[:-2]) if __name__ == '__main__': - module_name = raw_input("Name: ").capitalize() + module_name = raw_input("Module Name: ").capitalize() desc = raw_input("Description: ") + author_name = raw_input("Author: ") + author_email = raw_input("Email: ") methods = [] print "\nLeave blank to finish." while True: @@ -55,6 +73,7 @@ if __name__ == '__main__': # Write it out to a file file_name = "%s.py" % module_name.lower() file_obj = open(file_name, "w") - file_obj.write(populate_template(module_name, desc, methods)) + file_obj.write(populate_template(author_name, author_email, + module_name, desc, methods)) file_obj.close() print "Your module is ready to be hacked on. Wrote out to %s." % file_name |