1 """Thirdparty Packages for internal use.
7 def import_thirdparty(lib
):
9 Imports a thirdparty package "lib" by setting all paths correctly.
11 At the moment, there is only the "pyglet" library, so we just put
12 pyglet to sys.path temporarily, then import "lib" and then restore the path.
13 With more packages, we'll just put them to sys.path as well.
17 def new_import(name
, globals={}, locals={}, fromlist
=[]):
19 return old_import(name
, globals, locals, fromlist
)
21 sys
.path
.insert(0, os
.path
.join(os
.path
.abspath(os
.path
.dirname( \
22 __file__
)), "pyglet"))
24 m
= old_import(name
, globals, locals, fromlist
)
29 old_import
= __builtin__
.__import
__
30 __builtin__
.__import
__ = new_import
34 __builtin__
.__import
__ = old_import