annotate makeitso/python.py @ 96:cc17537254d2

add an install script template
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 09:58:10 -0800
parents e74baa8e6df4
children ad5fd3eb6674
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 python package templates for makeitso
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 Several components are included.
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 [TODO] You may use these subtemplates in any combination.
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 * README.txt : a README in restructured text
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 * examples : examples for your package
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 * setup.py : setup utility for the full package
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12 * ./main.py : CLI handler for your webapp
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 * ./model.py : model of a persisted object
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 * ./template.py : a MakeItSo template for project creation
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 * ./tests : doctest suite for the package
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 * ./web.py : a webob web handler
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 """
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 import sys
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 from cli import MakeItSoCLI
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 from optparse import OptionParser
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 from template import MakeItSoTemplate
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 class PythonPackage(MakeItSoTemplate):
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 """
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 python package template
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 """
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 name = 'python-package'
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 templates = ['python_package']
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 look = True
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 # things that go in setup.py
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 dependencies = {'web.py': ['webob'],
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34 'template.py': ['MakeItSo']}
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
35 console_scripts = {'main.py': '{{project}}.main:main',
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36 'template.py': '{{project}}.template:main'
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37 }
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
38
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
39 def __init__(self, **kw):
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
40 MakeItSoTemplate.__init__(self, **kw)
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
41
95
e74baa8e6df4 fix CLI interface a bit....write a test for it
Jeff Hammel <jhammel@mozilla.com>
parents: 78
diff changeset
42
78
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
43 def main(args=sys.argv[:]):
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
44 usage = '%prog [options]'
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
45
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
46
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
47 if __name__ == '__main__':
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
48 main()
d4184945f8a8 stub out python package creation
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
49