# HG changeset patch # User Jeff Hammel # Date 1375223396 25200 # Node ID 9033a5f11b9240ce777a83a279434993c74c0fae # Parent cfd4f1e910903e9e4180ba8228d9b1af2483733e wip diff -r cfd4f1e91090 -r 9033a5f11b92 makeitso/python.py --- a/makeitso/python.py Tue Jul 30 15:20:38 2013 -0700 +++ b/makeitso/python.py Tue Jul 30 15:29:56 2013 -0700 @@ -26,6 +26,12 @@ class PythonTemplate(MakeItSoTemplate): """abstract base class for python-type templates""" + vars = [Variable('description'), + Variable('author', 'author of the package'), + Variable('email', "author's email"), + Variable('url', 'project url'), + Variable('repo', 'project repository'), + ] def path2name(self, path): return os.path.basename(path.rstrip(os.path.sep)) @@ -33,7 +39,7 @@ class PythonScriptTemplate(PythonTemplate): """template for a single python script""" templates = [('python_package', '{{package}}', '{{main}}.py')] - + vars = [Variable('description')] class PythonModuleTemplate(PythonTemplate): """single module python package""" diff -r cfd4f1e91090 -r 9033a5f11b92 makeitso/python_module/{{module}}.py --- a/makeitso/python_module/{{module}}.py Tue Jul 30 15:20:38 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#!/usr/bin/env python - -""" -{{module}} -{{description}} -""" - -import optparse -import sys - -def add_options(parser): - """add {{module}} options to an OptionParser instance""" - - -def main(args=sys.argv[1:]): - - # parse command line arguments - usage = '%prog [options] ...' - class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): - """description formatter""" - def format_description(self, description): - if description: - return description.strip() + '\n' - else: - return '' - parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) - add_options(parser) - options, args = parser.parse_args(args) - -if __name__ == '__main__': - main() diff -r cfd4f1e91090 -r 9033a5f11b92 makeitso/python_package/{{package}}/main.py --- a/makeitso/python_package/{{package}}/main.py Tue Jul 30 15:20:38 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" -{{description}} -""" - -import optparse -import os -import subprocess -import sys - -def add_options(parser): - """add {{package}} options to an OptionParser instance""" - -def main(args=sys.argv[1:]): - - # parse command line options - usage = '%prog [options] ...' - class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): - """description formatter for console script entry point""" - def format_description(self, description): - if description: - return description.strip() + '\n' - else: - return '' - parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) - options, args = parser.parse_args(args) - -if __name__ == '__main__': - main() diff -r cfd4f1e91090 -r 9033a5f11b92 makeitso/python_package/{{package}}/{{main}}.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makeitso/python_package/{{package}}/{{main}}.py Tue Jul 30 15:29:56 2013 -0700 @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +{{description}} +""" + +import optparse +import os +import subprocess +import sys + +def add_options(parser): + """add {{package}} options to an OptionParser instance""" + +def main(args=sys.argv[1:]): + + # parse command line options + usage = '%prog [options] ...' + class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): + """description formatter for console script entry point""" + def format_description(self, description): + if description: + return description.strip() + '\n' + else: + return '' + parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) + options, args = parser.parse_args(args) + +if __name__ == '__main__': + main()