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/.
5 from __future__
import absolute_import
6 from __future__
import print_function
8 Run a python script, adding extra directories to the python path.
14 print >>sys
.stderr
, "pythonpath.py -I directory script.py [args...]"
32 paths
.append(os
.path
.abspath(path
))
35 if arg
.startswith('-I'):
36 paths
.append(os
.path
.abspath(args
.pop(0)[2:]))
43 sys
.path
[0:0] = [os
.path
.abspath(os
.path
.dirname(script
))] + paths
47 frozenglobals
['__name__'] = '__main__'
48 frozenglobals
['__file__'] = script
50 execfile(script
, frozenglobals
)
53 # Freeze scope here ... why this makes things work I have no idea ...
54 frozenglobals
= globals()
59 if __name__
== '__main__':