Index: py2exe/build_exe.py =================================================================== RCS file: /cvsroot/py2exe/py2exe/py2exe/build_exe.py,v retrieving revision 1.28 diff -u -r1.28 build_exe.py --- py2exe/build_exe.py 6 May 2004 08:28:34 -0000 1.28 +++ py2exe/build_exe.py 12 May 2004 20:35:52 -0000 @@ -23,6 +23,7 @@ # resource constants RT_BITMAP=2 +_py_suffixes = ['.py', '.pyc', '.pyo'] _c_suffixes = [_triple[0] for _triple in imp.get_suffixes() if _triple[2] == imp.C_EXTENSION] @@ -779,16 +780,15 @@ continue src = item.__file__ if src: - if src.endswith(".py"): + suffix = os.path.splitext(src)[1] + + if suffix in _py_suffixes: py_files.append(item) - continue - for suffix in _c_suffixes: - if src.endswith(suffix): - extensions.append(item) - loader = self.create_loader(item) - if loader: - py_files.append(loader) - break + elif suffix in _c_suffixes: + extensions.append(item) + loader = self.create_loader(item) + if loader: + py_files.append(loader) else: raise RuntimeError \ ("Don't know how to handle '%s'" % repr(src)) @@ -1139,8 +1139,12 @@ from distutils.dep_util import newer for file in py_files: - if file.__file__[-3:] != ".py": - raise RuntimeError, "cannot compile '%s'" % file.__file__ + suffix = os.path.splitext(file.__file__)[1] + if suffix != ".py": + if suffix in _py_suffixes: + continue # these are already compiled + else: + raise RuntimeError, "cannot compile '%s'" % file.__file__ # Terminology from the py_compile module: # cfile - byte-compiled file