comparison makeitso/mkpydir.py @ 167:f6474c7dfb39

makeitso/mkpydir.py
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 20 Oct 2013 03:54:54 -0700
parents
children 7d8f3660fabb
comparison
equal deleted inserted replaced
166:0c95d7f25d9b 167:f6474c7dfb39
1 #!/usr/bin/env python
2
3 """
4 make a python module directory with an __init__.py
5 """
6
7 import optparse
8 import os
9 import sys
10
11 def main(args=sys.argv[1:]):
12
13 usage = '%prog [options] directory_name'
14 parser = optparse.OptionParser(usage=usage, description=__doc__)
15 options, args = parser.parse_args(args)
16 if len(args) != 1:
17 parser.print_usage()
18 parser.error()
19
20 os.makedirs(args[0])
21 init = os.path.join(args[0], '__init__.py')
22 with f as open(init, 'w'):
23 f.write('#\n')
24
25 if __name__ == '__main__':
26 main()