| 167 | 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() |