24 """ helper for finding all required modules of package <packagename> """ |
24 """ helper for finding all required modules of package <packagename> """ |
25 # Use the package in the build directory |
25 # Use the package in the build directory |
26 libpath = os.path.abspath(libpath) |
26 libpath = os.path.abspath(libpath) |
27 sys.path.insert(0,libpath) |
27 sys.path.insert(0,libpath) |
28 packdir = os.path.join(libpath,packagename) |
28 packdir = os.path.join(libpath,packagename) |
29 # A normal import would not find the package in |
29 # A normal import would not find the package in |
30 # the build directory. ihook is used to force the import. |
30 # the build directory. ihook is used to force the import. |
31 # After the package is imported the import scope for |
31 # After the package is imported the import scope for |
32 # the following imports is settled. |
32 # the following imports is settled. |
33 p = importfrom(packdir) |
33 p = importfrom(packdir) |
34 globals()[packagename] = p |
34 globals()[packagename] = p |
35 sys.modules[packagename] = p |
35 sys.modules[packagename] = p |
36 # Fetch the python modules in the package |
36 # Fetch the python modules in the package |
44 # Import all python modules and by that run the fake demandload |
44 # Import all python modules and by that run the fake demandload |
45 for m in pymodulefiles: |
45 for m in pymodulefiles: |
46 if m == '__init__.py': continue |
46 if m == '__init__.py': continue |
47 tmp = {} |
47 tmp = {} |
48 mname,ext = os.path.splitext(m) |
48 mname,ext = os.path.splitext(m) |
49 fullname = packagename+'.'+mname |
49 fullname = packagename+'.'+mname |
50 __import__(fullname,tmp,tmp) |
50 __import__(fullname,tmp,tmp) |
51 requiredmodules[fullname] = 1 |
51 requiredmodules[fullname] = 1 |
52 # Import all extension modules and by that run the fake demandload |
52 # Import all extension modules and by that run the fake demandload |
53 for m in extmodulefiles: |
53 for m in extmodulefiles: |
54 tmp = {} |
54 tmp = {} |