Anthony Tuininga avatar 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.

Comments (0)

Files changed (1)


                     [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)
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
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.