Commits

Anthony Tuininga  committed d6ba633

Add support for binary path includes as well as excludes; use sequences
rather than dictionaries as a more convenient API; exclude the standard
locations for 32-bit and 64-bit libaries in multi-architecture systems.

  • Participants
  • Parent commits b8f519b

Comments (0)

Files changed (1)

File cx_Freeze/freezer.py

 
 if sys.platform == "win32":
     pythonDll = "python%s%s.dll" % sys.version_info[:2]
-    GLOBAL_BIN_PATH_EXCLUDES = [cx_Freeze.util.GetSystemDir().lower()]
+    GLOBAL_BIN_PATH_EXCLUDES = [cx_Freeze.util.GetSystemDir()]
     GLOBAL_BIN_INCLUDES = [
             pythonDll,
             "gdiplus.dll",
             "libclntsh.so",
             "libwtc9.so"
     ]
-    GLOBAL_BIN_PATH_EXCLUDES = ["/lib", "/usr/lib"]
+    GLOBAL_BIN_PATH_EXCLUDES = ["/lib", "/lib32", "/lib64", "/usr/lib",
+            "/usr/lib32", "/usr/lib64"]
 
 
 # NOTE: the try: except: block in this code is not necessary under Python 2.4
             base = None, path = None, createLibraryZip = None,
             appendScriptToExe = None, appendScriptToLibrary = None,
             targetDir = None, binIncludes = [], binExcludes = [],
-            binPathExcludes = [], icon = None, includeFiles = []):
+            binPathIncludes = [], binPathExcludes = [], icon = None,
+            includeFiles = []):
         self.executables = executables
         self.constantsModules = constantsModules
         self.includes = includes
         self.appendScriptToExe = appendScriptToExe
         self.appendScriptToLibrary = appendScriptToLibrary
         self.targetDir = targetDir
-        self.binIncludes = dict.fromkeys(GLOBAL_BIN_INCLUDES)
-        for name in binIncludes:
-            self.binIncludes[os.path.normcase(name)] = None
-        self.binExcludes = dict.fromkeys(GLOBAL_BIN_EXCLUDES)
-        for name in binExcludes:
-            self.binExcludes[os.path.normcase(name)] = None
-        self.binPathExcludes = dict.fromkeys(GLOBAL_BIN_PATH_EXCLUDES)
-        for name in binPathExcludes:
-            self.binPathExcludes[os.path.normcase(name)] = None
+        self.binIncludes = [os.path.normcase(n) \
+                for n in GLOBAL_BIN_INCLUDES + binIncludes]
+        self.binExcludes = [os.path.normcase(n) \
+                for n in GLOBAL_BIN_EXCLUDES + binExcludes]
+        self.binPathIncludes = [os.path.normcase(n) for n in binPathIncludes]
+        self.binPathExcludes = [os.path.normcase(n) \
+                for n in GLOBAL_BIN_PATH_EXCLUDES + binPathExcludes]
         self.icon = icon
         self.includeFiles = includeFiles
         self._VerifyConfiguration()
             return True
         if name in self.binExcludes:
             return False
-        if dir in self.binPathExcludes:
-            return False
+        for path in self.binPathIncludes:
+            if dir.startswith(path):
+                return True
+        for path in self.binPathExcludes:
+            if dir.startswith(path):
+                return False
         return True
 
     def _VerifyCanAppendToLibrary(self):