1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 Run a python script, adding extra directories to the python path.
12 print >>sys
.stderr
, "pythonpath.py -I directory script.py [args...]"
30 paths
.append(os
.path
.abspath(path
))
33 if arg
.startswith('-I'):
34 paths
.append(os
.path
.abspath(args
.pop(0)[2:]))
41 sys
.path
[0:0] = [os
.path
.abspath(os
.path
.dirname(script
))] + paths
45 frozenglobals
['__name__'] = '__main__'
46 frozenglobals
['__file__'] = script
48 execfile(script
, frozenglobals
)
51 # Freeze scope here ... why this makes things work I have no idea ...
52 frozenglobals
= globals()
57 if __name__
== '__main__':