Commits

Anthony Tuininga  committed 290b006

Fix support for Python 3.3. Rather than embed the importlib.h file generated
and intended to be used solely by the C Python implementation, include the
importlib._bootstrap module in the base modules, as recommended by Amaury
Forgeot d'Arc.

  • Participants
  • Parent commits ec1efee

Comments (0)

Files changed (2)

 python setup.py build
 python setup.py install
 
-NOTE: as of Python 3.3, the file importlib.h from the source used to build
-Python is required in order to build cx_Freeze. Copy or link it so that the
-compiler is able to include it.
-

File cx_Freeze/finder.py

         self.IncludePackage("encodings")
         if sys.version_info[0] >= 3:
             self.IncludeModule("io")
+        if sys.version_info[:2] >= (3, 3):
+            self.AddAlias("_frozen_importlib", "importlib._bootstrap")
+            self.IncludeModule("_frozen_importlib")
         if self.copyDependentFiles:
             self.IncludeModule("imp")
             self.IncludeModule("os")
         if not os.path.isdir(dirName):
             os.makedirs(dirName)
         outfp = open(fileName, "w")
-        if sys.version_info[:2] >= (3, 3):
-            outfp.write('#include "importlib.h"\n\n')
         names = list(self._modules.keys())
         names.sort()
         modulesWritten = []
                     outfp.write("%d," % op)
             outfp.write("\n};\n\n");
         outfp.write("static struct _frozen gFrozenModules[] = {\n")
-        if sys.version_info[:2] >= (3, 3):
-            outfp.write('    {"_frozen_importlib", _Py_M__importlib, ' \
-                    '(int)sizeof(_Py_M__importlib)},\n')
         for name, mangledName, size in modulesWritten:
             outfp.write('    {"%s", M_%s, %d},\n' % (name, mangledName, size))
         outfp.write("    {0, 0, 0}\n};\n")