|
|
@@ -36,14 +36,9 @@ isDebugBuild = (python.lower().endswith('_d'))
|
|
|
# NB. if encodings are removed, be sure to remove them from the shortcut in
|
|
|
# deploy-stub.c.
|
|
|
startupModules = [
|
|
|
- 'imp', 'encodings', 'encodings.*',
|
|
|
+ 'imp', 'encodings', 'encodings.*', 'io', 'marshal', 'importlib.machinery',
|
|
|
+ 'importlib.util',
|
|
|
]
|
|
|
-if sys.version_info >= (3, 0):
|
|
|
- # Modules specific to Python 3
|
|
|
- startupModules += ['io', 'marshal', 'importlib.machinery', 'importlib.util']
|
|
|
-else:
|
|
|
- # Modules specific to Python 2
|
|
|
- startupModules += []
|
|
|
|
|
|
# These are some special init functions for some built-in Python modules that
|
|
|
# deviate from the standard naming convention. A value of None means that a
|
|
|
@@ -75,6 +70,7 @@ hiddenImports = {
|
|
|
'datetime': ['_strptime'],
|
|
|
'keyring.backends': ['keyring.backends.*'],
|
|
|
'matplotlib.font_manager': ['encodings.mac_roman'],
|
|
|
+ 'matplotlib.backends._backend_tk': ['tkinter'],
|
|
|
'direct.particles': ['direct.particles.ParticleManagerGlobal'],
|
|
|
'numpy.core._multiarray_umath': [
|
|
|
'numpy.core._internal',
|
|
|
@@ -83,12 +79,6 @@ hiddenImports = {
|
|
|
],
|
|
|
}
|
|
|
|
|
|
-if sys.version_info >= (3,):
|
|
|
- hiddenImports['matplotlib.backends._backend_tk'] = ['tkinter']
|
|
|
-else:
|
|
|
- hiddenImports['matplotlib.backends._backend_tk'] = ['Tkinter']
|
|
|
-
|
|
|
-
|
|
|
# These are overrides for specific modules.
|
|
|
overrideModules = {
|
|
|
# Used by the warnings module, among others, to get line numbers. Since
|
|
|
@@ -1310,11 +1300,7 @@ class Freezer:
|
|
|
|
|
|
def __addPyc(self, multifile, filename, code, compressionLevel):
|
|
|
if code:
|
|
|
- data = imp.get_magic() + b'\0\0\0\0'
|
|
|
-
|
|
|
- if sys.version_info >= (3, 0):
|
|
|
- data += b'\0\0\0\0'
|
|
|
-
|
|
|
+ data = imp.get_magic() + b'\0\0\0\0\0\0\0\0'
|
|
|
data += marshal.dumps(code)
|
|
|
|
|
|
stream = StringStream(data)
|
|
|
@@ -1671,10 +1657,7 @@ class Freezer:
|
|
|
# initmodule or PyInit_module function.
|
|
|
modname = mod.split('.')[-1]
|
|
|
libfile = modname + '.lib'
|
|
|
- if sys.version_info >= (3, 0):
|
|
|
- symbolName = 'PyInit_' + modname
|
|
|
- else:
|
|
|
- symbolName = 'init' + modname
|
|
|
+ symbolName = 'PyInit_' + modname
|
|
|
os.system('lib /nologo /def /export:%s /name:%s.pyd /out:%s' % (symbolName, modname, libfile))
|
|
|
extraLink.append(libfile)
|
|
|
cleanFiles += [libfile, modname + '.exp']
|
|
|
@@ -1778,10 +1761,7 @@ class Freezer:
|
|
|
code = 'import sys;del sys.modules["%s"];import sys,os,imp;imp.load_dynamic("%s",os.path.join(sys.path[0], "%s%s"))' % (moduleName, moduleName, moduleName, modext)
|
|
|
else:
|
|
|
code = 'import sys;del sys.modules["%s"];import sys,os,imp;imp.load_dynamic("%s",os.path.join(os.path.dirname(sys.executable), "%s%s"))' % (moduleName, moduleName, moduleName, modext)
|
|
|
- if sys.version_info >= (3, 2):
|
|
|
- code = compile(code, moduleName, 'exec', optimize=2)
|
|
|
- else:
|
|
|
- code = compile(code, moduleName, 'exec')
|
|
|
+ code = compile(code, moduleName, 'exec', optimize=2)
|
|
|
code = marshal.dumps(code)
|
|
|
moduleList.append((moduleName, len(pool), len(code)))
|
|
|
pool += code
|
|
|
@@ -2273,7 +2253,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|
|
except KeyError:
|
|
|
return None
|
|
|
|
|
|
- if sys.version_info >= (3, 0) and 'b' not in mode:
|
|
|
+ if 'b' not in mode:
|
|
|
return io.TextIOWrapper(fp, encoding='utf8')
|
|
|
return fp
|
|
|
|
|
|
@@ -2358,27 +2338,14 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|
|
raise
|
|
|
|
|
|
co = marshal.loads(memoryview(data)[16:])
|
|
|
- elif sys.version_info >= (3, 4):
|
|
|
+ else:
|
|
|
try:
|
|
|
- if sys.version_info >= (3, 5):
|
|
|
- marshal_data = importlib._bootstrap_external._validate_bytecode_header(fp.read())
|
|
|
- else:
|
|
|
- marshal_data = importlib._bootstrap._validate_bytecode_header(fp.read())
|
|
|
+ marshal_data = importlib._bootstrap_external._validate_bytecode_header(fp.read())
|
|
|
except ImportError as exc:
|
|
|
self.msgout(2, "raise ImportError: " + str(exc), pathname)
|
|
|
raise
|
|
|
|
|
|
co = marshal.loads(marshal_data)
|
|
|
- else:
|
|
|
- if fp.read(4) != imp.get_magic():
|
|
|
- self.msgout(2, "raise ImportError: Bad magic number", pathname)
|
|
|
- raise ImportError("Bad magic number in %s" % pathname)
|
|
|
-
|
|
|
- fp.read(4)
|
|
|
- if sys.version_info >= (3, 3):
|
|
|
- fp.read(4)
|
|
|
-
|
|
|
- co = marshal.load(fp)
|
|
|
else:
|
|
|
co = None
|
|
|
|
|
|
@@ -2488,7 +2455,7 @@ class PandaModuleFinder(modulefinder.ModuleFinder):
|
|
|
|
|
|
# If we found folders on the path with this module name without an
|
|
|
# __init__.py file, we should consider this a namespace package.
|
|
|
- if ns_dirs and sys.version_info >= (3, 3):
|
|
|
+ if ns_dirs:
|
|
|
return (None, ns_dirs, ('', '', _PKG_NAMESPACE_DIRECTORY))
|
|
|
|
|
|
raise ImportError(name)
|