changeset 155:386a44a52139

moving to a thing with script template
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 05 Jun 2013 13:38:23 -0700
parents ebc5cfe17d95
children a7a7c364568a
files examples/python-templates/unittest_template.py makeitso/python.py makeitso/python_package/{{package}}/main.py
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/python-templates/unittest_template.py	Wed Jun 05 13:38:23 2013 -0700
@@ -0,0 +1,10 @@
+#!/usr/bin/env python                                                           
+
+"""                                                                             
+"""
+
+class TestAddonBackup(unittest.TestCase):
+    pass
+
+if __name__ == '__main__':
+    unittest.main()
--- a/makeitso/python.py	Sat Dec 01 19:35:46 2012 -0800
+++ b/makeitso/python.py	Wed Jun 05 13:38:23 2013 -0700
@@ -27,10 +27,18 @@
 class PythonTemplate(MakeItSoTemplate):
   """abstract base class for python-type templates"""
 
+
+class PythonScriptTemplate(PythonTemplate):
+  """template for a single python script"""
+  templates = [os.path.join('python_package', '{{package}}', 'main.py')]
+
+
 class PythonModuleTemplate(PythonTemplate):
   """single module python package"""
+  # TODO: this should use the same files as PythonPackageTemplate
   templates = ['python_module']
 
+
 class PythonPackageTemplate(PythonTemplate):
   """
   python package template
@@ -76,7 +84,7 @@
       dependencies.update(dependency)
     dependencies = list(dependencies)
     variables['dependencies'] = dependencies
-      
+
     # console_scripts
     console_scripts = []
     for template, console_script in self.console_scripts.items():
@@ -105,4 +113,4 @@
   cli(*args)
 
 if __name__ == '__main__':
-  main()  
+  main()
--- a/makeitso/python_package/{{package}}/main.py	Sat Dec 01 19:35:46 2012 -0800
+++ b/makeitso/python_package/{{package}}/main.py	Wed Jun 05 13:38:23 2013 -0700
@@ -7,7 +7,7 @@
 import sys
 import optparse
 
-def main(args=sys.argv[:]):
+def main(args=sys.argv[1:]):
 
     # parse command line options
     usage = '%prog [options]'