1. Anthony Tuininga
  2. cx_Freeze

Commits

Anthony Tuininga  committed c244c83

Avoid selecting a .pyc or .pyo file from the initscripts directory which causes
a compilation error regarding null bytes if that situation occurs.

  • Participants
  • Parent commits 383613a
  • Branches default

Comments (0)

Files changed (1)

File cx_Freeze/freezer.py

View file
                     [f for f in dependentFiles if self._ShouldCopyFile(f)]
         return dependentFiles
 
-    def _GetFileName(self, dir, name):
+    def _GetFileName(self, dir, name, ext = None):
         if os.path.isabs(name):
             return name
         name = os.path.normcase(name)
         fullDir = os.path.join(os.path.dirname(cx_Freeze.__file__), dir)
         if os.path.isdir(fullDir):
             for fileName in os.listdir(fullDir):
-                if name == os.path.splitext(os.path.normcase(fileName))[0]:
+                checkName, checkExt = \
+                        os.path.splitext(os.path.normcase(fileName))
+                if name == checkName and (ext is None or ext == checkExt):
                     return os.path.join(fullDir, fileName)
 
     def _GetInitScriptFileName(self, argsSource = None):
                 name = "ConsoleKeepPath"
             if sys.version_info[0] >= 3:
                 name += "3"
-        argsSource.initScript = self._GetFileName("initscripts", name)
+        argsSource.initScript = self._GetFileName("initscripts", name, ".py")
         if argsSource.initScript is None:
             raise ConfigError("no initscript named %s", name)