Mercurial > hg > MakeItSo
annotate makeitso/python_package/{{package}}/{{main}}.py @ 180:9b78f52afe4e
STUB: makeitso/python.py setup.py
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 14 Mar 2014 13:34:52 -0700 |
parents | a5d058957734 |
children | 74f41d53b057 |
rev | line source |
---|---|
79 | 1 #!/usr/bin/env python |
159 | 2 # -*- coding: utf-8 -*- |
79 | 3 |
4 """ | |
5 {{description}} | |
6 """ | |
7 | |
159 | 8 import optparse |
9 import os | |
10 import subprocess | |
79 | 11 import sys |
159 | 12 |
13 def add_options(parser): | |
161 | 14 """add options to the OptionParser instance""" |
79 | 15 |
155
386a44a52139
moving to a thing with script template
Jeff Hammel <jhammel@mozilla.com>
parents:
149
diff
changeset
|
16 def main(args=sys.argv[1:]): |
130
d9201f911458
better description formatting
Jeff Hammel <jhammel@mozilla.com>
parents:
79
diff
changeset
|
17 |
139 | 18 # parse command line options |
159 | 19 usage = '%prog [options] ...' |
139 | 20 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): |
140 | 21 """description formatter for console script entry point""" |
139 | 22 def format_description(self, description): |
23 if description: | |
149 | 24 return description.strip() + '\n' |
139 | 25 else: |
26 return '' | |
27 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | |
28 options, args = parser.parse_args(args) | |
79 | 29 |
30 if __name__ == '__main__': | |
139 | 31 main() |