3 # Copyright 2008, Red Hat, Inc
4 # Steve 'Ashcrow' Milner <smilner@redhat.com>
5 # John Eckersberg <jeckersb@redhat.com>
7 # This software may be freely redistributed under the terms of the GNU
8 # general public license.
10 # You should have received a copy of the GNU General Public License
11 # along with this program; if not, write to the Free Software
12 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 # This software may be freely redistributed under the terms of the GNU
20 # general public license.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 class %s(func_module.FuncModule):
30 # Update these if need be.
38 METHOD_TEMPLATE
= '''\
48 def populate_template(author_name
, author_email
, module_name
, desc
, methods
):
50 Makes the method strings and populates the template.
52 from datetime
import datetime
55 for method
in methods
:
56 actual_methods
+= METHOD_TEMPLATE
% method
57 return TEMPLATE
% (datetime
.now().strftime("%Y"), author_name
,
58 author_email
, module_name
, desc
, actual_methods
[:-2])
61 if __name__
== '__main__':
62 module_name
= raw_input("Module Name: ").capitalize()
63 desc
= raw_input("Description: ")
64 author_name
= raw_input("Author: ")
65 author_email
= raw_input("Email: ")
67 print "\nLeave blank to finish."
69 method
= raw_input("Method: ")
72 methods
.append(method
)
73 # Write it out to a file
74 file_name
= "%s.py" % module_name
.lower()
75 file_obj
= open(file_name
, "w")
76 file_obj
.write(populate_template(author_name
, author_email
,
77 module_name
, desc
, methods
))
79 print "Your module is ready to be hacked on. Wrote out to %s." % file_name