Commits

Anthony Tuininga  committed f99f5ff

Fix inclusion of packages within packages (Issue #3 on the bitbucket site).

  • Participants
  • Parent commits 9f0a8c5

Comments (0)

Files changed (2)

File cx_Freeze/finder.py

     def _ImportAllSubModules(self, module, deferredImports, recursive = True):
         """Import all sub modules to the given package."""
         suffixes = [s[0] for s in imp.get_suffixes()]
-        for dir in module.path:
+        for path in module.path:
             try:
-                fileNames = os.listdir(dir)
+                fileNames = os.listdir(path)
             except os.error:
                 continue
             for fileName in fileNames:
-                # We need to run through these in order to correctly pick up
-                # PEP 3149 library names (e.g. .cpython-32mu.so).
-                for suffix in suffixes:
-                    if fileName.endswith(suffix):
-                        name = fileName[:-len(suffix)]
-                        break
+                fullName = os.path.join(path, fileName)
+                if os.path.isdir(fullName):
+                    initFile = os.path.join(fullName, "__init__.py")
+                    if not os.path.exists(initFile):
+                        continue
+                    name = fileName
                 else:
-                    continue
-                if name == "__init__":
-                    continue
+                    # We need to run through these in order to correctly pick
+                    # up PEP 3149 library names (e.g. .cpython-32mu.so).
+                    for suffix in suffixes:
+                        if fileName.endswith(suffix):
+                            name = fileName[:-len(suffix)]
+                            break
+                    else:
+                        continue
+                    if name == "__init__":
+                        continue
                 subModuleName = "%s.%s" % (module.name, name)
                 subModule, returnError = \
                         self._InternalImportModule(subModuleName,

File doc/releasenotes.rst

 * Running Windows GUI applications in a path containing non-ASCII characters.
 * Calculate the correct filename for the Python shared library in Python 3.2.
   (`Issue 3411270 <http://sourceforge.net/tracker/?func=detail&aid=3411270&group_id=84937&atid=574390>`_)
+* Including a package would not include the packages within that package, only
+  the modules within that package.
+  (`Issue #3 <https://bitbucket.org/anthony_tuininga/cx_freeze/issue/3/subpackages-on-windows>`_)
 
 
 Version 4.2.3