author | noe\swadi |
Thu, 18 Feb 2010 12:29:02 +0530 | |
changeset 1 | 22878952f6e2 |
permissions | -rw-r--r-- |
1 | 1 |
attrs = [('notamodule','')] |
2 |
def hook(mod): |
|
3 |
import os, sys, marshal |
|
4 |
other = os.path.join(mod.__path__[0], '../pkg2/__init__.pyc') |
|
5 |
if os.path.exists(other): |
|
6 |
co = marshal.loads(open(other,'rb').read()[8:]) |
|
7 |
else: |
|
8 |
co = compile(open(other[:-1],'r').read()+'\n', other, 'exec') |
|
9 |
mod.__init__(mod.__name__, other, co) |
|
10 |
mod.__path__.append(os.path.join(mod.__path__[0], 'extra')) |
|
11 |
return mod |