Back to index

enigmail  1.4.3
Functions | Variables
pythonpath Namespace Reference

Functions

def main

Variables

tuple frozenglobals = globals()

Detailed Description

Run a python script, adding extra directories to the python path.

Function Documentation

def pythonpath.main (   args)

Definition at line 6 of file pythonpath.py.

00006 
00007 def main(args):
00008     def usage():
00009         print >>sys.stderr, "pythonpath.py -I directory script.py [args...]"
00010         sys.exit(150)
00011 
00012     paths = []
00013 
00014     while True:
00015         try:
00016             arg = args[0]
00017         except IndexError:
00018             usage()
00019 
00020         if arg == '-I':
00021             args.pop(0)
00022             try:
00023                 path = args.pop(0)
00024             except IndexError:
00025                 usage()
00026 
00027             paths.append(os.path.abspath(path))
00028             continue
00029 
00030         if arg.startswith('-I'):
00031             paths.append(os.path.abspath(args.pop(0)[2:]))
00032             continue
00033 
00034         break
00035 
00036     script = args[0]
00037 
00038     sys.path[0:0] = [os.path.abspath(os.path.dirname(script))] + paths
00039     sys.argv = args
00040     sys.argc = len(args)
00041 
00042     frozenglobals['__name__'] = '__main__'
00043     frozenglobals['__file__'] = script
00044 
00045     execfile(script, frozenglobals)
00046 
# Freeze scope here ... why this makes things work I have no idea ...

Here is the call graph for this function:


Variable Documentation

tuple pythonpath.frozenglobals = globals()

Definition at line 47 of file pythonpath.py.