Commits

Anthony Tuininga committed b21de9c

Handle deferred imports recursively as needed; ensure that from lists do not
automatically indicate that they are part of the module or the deferred import
processing doesn't actually work!

Comments (0)

Files changed (1)

cx_Freeze/finder.py

 
 LOAD_CONST = opcode.opmap["LOAD_CONST"]
 IMPORT_NAME = opcode.opmap["IMPORT_NAME"]
+IMPORT_FROM = opcode.opmap["IMPORT_FROM"]
 STORE_NAME = opcode.opmap["STORE_NAME"]
 STORE_GLOBAL = opcode.opmap["STORE_GLOBAL"]
 STORE_OPS = (STORE_NAME, STORE_GLOBAL)
 
     def _ImportDeferredImports(self, deferredImports):
         """Import any sub modules that were deferred, if applicable."""
-        for packageModule, subModuleNames in deferredImports:
-            self._EnsureFromList(packageModule, packageModule, subModuleNames,
-                    deferredImports)
+        while deferredImports:
+            newDeferredImports = []
+            for packageModule, subModuleNames in deferredImports:
+                self._EnsureFromList(packageModule, packageModule,
+                        subModuleNames, newDeferredImports)
+            deferredImports = newDeferredImports
 
     def _ImportModule(self, name, deferredImports, caller = None,
             relativeImportIndex = 0):
                         if fromList and subModule.path is not None:
                             self._EnsureFromList(module, subModule, fromList,
                                     deferredImports)
+            elif op == IMPORT_FROM:
+                opIndex += 3
             else:
                 arguments = []
                 if op in STORE_OPS:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.