annotate makeitso/script2package.py @ 170:1b2ccecfff77

versionbump
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 20 Oct 2013 18:20:08 -0700
parents 6cd2894bb11c
children aed8c4af5f26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
164
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 """
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5 make a package from a .py file
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
6 """
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 ### STUB ###
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9 # TODO:
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
10 # - thing to make a setup.py from a .py file
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
11 # - use makeitso templates -> directory structure
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
12
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 import optparse
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 import os
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 import subprocess
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 import sys
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 def add_options(parser):
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 """add options to the OptionParser instance"""
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 def main(args=sys.argv[1:]):
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 # parse command line options
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 usage = '%prog [options] ...'
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 """description formatter for console script entry point"""
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 def format_description(self, description):
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
28 if description:
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
29 return description.strip() + '\n'
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
30 else:
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
31 return ''
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
32 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
33 options, args = parser.parse_args(args)
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
34
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
35 if __name__ == '__main__':
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
36 main()
6cd2894bb11c stub: makeitso/script2package.py
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
37