srcanamdw/codescanner/pyinstaller/buildtests/hooks1/hook-pkg1.py
changeset 1 22878952f6e2
equal deleted inserted replaced
0:509e4801c378 1:22878952f6e2
       
     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