From: <th...@us...> - 2014-05-09 17:25:10
|
Revision: 742 http://sourceforge.net/p/py2exe/svn/742 Author: theller Date: 2014-05-09 17:25:07 +0000 (Fri, 09 May 2014) Log Message: ----------- Allow and document 'bundle-files == 0' in the setup-script version. Modified Paths: -------------- trunk/py2exe-3/py2exe/distutils_buildexe.py trunk/py2exe-3/py2exe/setup_template.py Modified: trunk/py2exe-3/py2exe/distutils_buildexe.py =================================================================== --- trunk/py2exe-3/py2exe/distutils_buildexe.py 2014-05-08 19:55:04 UTC (rev 741) +++ trunk/py2exe-3/py2exe/distutils_buildexe.py 2014-05-09 17:25:07 UTC (rev 742) @@ -157,8 +157,8 @@ self.includes = fancy_split(self.includes) self.ignores = fancy_split(self.ignores) self.bundle_files = int(self.bundle_files) - if self.bundle_files < 1 or self.bundle_files > 3: - raise ValueError("bundle-files must be 1, 2, or 3, not %s" + if self.bundle_files < 0 or self.bundle_files > 3: + raise ValueError("bundle-files must be 0, 1, 2, or 3, not %s" % self.bundle_files) if self.ascii: warnings.warn("The 'ascii' option is no longer supported, ignored.") Modified: trunk/py2exe-3/py2exe/setup_template.py =================================================================== --- trunk/py2exe-3/py2exe/setup_template.py 2014-05-08 19:55:04 UTC (rev 741) +++ trunk/py2exe-3/py2exe/setup_template.py 2014-05-09 17:25:07 UTC (rev 742) @@ -138,6 +138,12 @@ # and loaded in the normal way. # # bundle_files == 1: +# Extension modules and the Python dll are put into the zipfile or +# the exe/dll files, and everything is loaded without unpacking to +# the file system. This does not work for some dlls, so use with +# caution. +# +# bundle_files == 0: # Extension modules, the Python dll, and other needed dlls are put # into the zipfile or the exe/dll files, and everything is loaded # without unpacking to the file system. This does not work for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2014-09-18 18:14:25
|
Revision: 752 http://sourceforge.net/p/py2exe/svn/752 Author: theller Date: 2014-09-18 18:14:22 +0000 (Thu, 18 Sep 2014) Log Message: ----------- ## Lines starting with '## ' will be removed from the log message. ## File(s) to commit: ## ChangeLog ## py2exe/mf3.py Enumerate subpackages and import all modules from the recursively. Modified Paths: -------------- trunk/py2exe-3/py2exe/dllfinder.py trunk/py2exe-3/py2exe/mf34.py Modified: trunk/py2exe-3/py2exe/dllfinder.py =================================================================== --- trunk/py2exe-3/py2exe/dllfinder.py 2014-09-18 18:13:48 UTC (rev 751) +++ trunk/py2exe-3/py2exe/dllfinder.py 2014-09-18 18:14:22 UTC (rev 752) @@ -8,7 +8,10 @@ import os import sys -from . mf3 import ModuleFinder +if sys.version_info >= (3, 4): + from . mf34 import ModuleFinder +else: + from . mf3 import ModuleFinder from . import hooks ################################ Modified: trunk/py2exe-3/py2exe/mf34.py =================================================================== --- trunk/py2exe-3/py2exe/mf34.py 2014-09-18 18:13:48 UTC (rev 751) +++ trunk/py2exe-3/py2exe/mf34.py 2014-09-18 18:14:22 UTC (rev 752) @@ -1,4 +1,4 @@ -#!/usr/bin/python3.3 +#!/usr/bin/python3.4 # -*- coding: utf-8 -*- """ModuleFinder based on importlib """ @@ -14,6 +14,7 @@ import struct import sys import textwrap +import warnings # XXX Clean up once str8's cstor matches bytes. LOAD_CONST = bytes([dis.opname.index('LOAD_CONST')]) @@ -23,31 +24,7 @@ STORE_OPS = [STORE_NAME, STORE_GLOBAL] HAVE_ARGUMENT = bytes([dis.HAVE_ARGUMENT]) -# Monkeypatch some missing methods in Python 3.3's NamespaceLoader -def __patch_py33(): - if sys.version_info < (3, 4): - def is_package(self, fullname): - return True - def get_source(self, fullname): - return '' - - def get_code(self, fullname): - return compile('', '<string>', 'exec', dont_inherit=True) - - def init_module_attrs(self, module): - module.__loader__ = self - module.__package__ = module.__name__ - from importlib._bootstrap import NamespaceLoader - NamespaceLoader.is_package = is_package - NamespaceLoader.get_source = get_source - NamespaceLoader.get_code = get_code - NamespaceLoader.init_module_attrs = init_module_attrs - -__patch_py33() -del __patch_py33 - - class ModuleFinder: def __init__(self, path=None, verbose=0, excludes=None, optimize=0, ignores=None): @@ -79,7 +56,11 @@ """ assert "__SCRIPT__" not in sys.modules ldr = importlib.machinery.SourceFileLoader("__SCRIPT__", path) - mod = Module(ldr, "__SCRIPT__", self._optimize) + if sys.version_info >= (3, 4): + spec = importlib.machinery.ModuleSpec("__SCRIPT__", ldr) + mod = Module(spec, "__SCRIPT__", self._optimize) + else: + mod = Module(ldr, "__SCRIPT__", self._optimize) # Do NOT add it... # self._add_module("__SCRIPT__", mod) self._scan_code(mod.__code__, mod) @@ -95,6 +76,8 @@ raise TypeError("{0} is not a package".format(name)) for finder, modname, ispkg in pkgutil.iter_modules(package.__path__): self.safe_import_hook("%s.%s" % (name, modname)) + if ispkg: + self.import_package("%s.%s" % (name, modname)) def import_hook(self, name, caller=None, fromlist=(), level=0): @@ -298,14 +281,27 @@ msg = ('No module named {!r}; {} is not a package').format(name, parent) self._add_badmodule(name) raise ImportError(msg, name=name) - loader = importlib.find_loader(name, path) - if loader is None: + try: + spec = importlib.util.find_spec(name, path) + except ValueError as details: + # workaround for the .pth file for namespace packages that + # setuptools installs. The pth file inserts a 'damaged' + # module into sys.modules: it has no __spec__. Reloading + # the module helps (at least in Python3.4). + if details.args[0] == '{}.__spec__ is None'.format(name): + import imp + _ = __import__(name, path) + imp.reload(_) + spec = importlib.util.find_spec(name, path) + else: + raise + if spec is None: self._add_badmodule(name) raise ImportError(name) elif name not in self.modules: # The parent import may have already imported this module. try: - self._load_module(loader, name) + self._load_module(spec, name) except ImportError: self._add_badmodule(name) raise @@ -335,8 +331,8 @@ self.modules[name] = mod - def _load_module(self, loader, name): - mod = Module(loader, name, self._optimize) + def _load_module(self, spec, name): + mod = Module(spec, name, self._optimize) self._add_module(name, mod) if name in self._package_paths: mod.__path__.extend(self._package_paths[name]) @@ -481,8 +477,10 @@ print("P", end=" ") else: print("m", end=" ") - print("%-35s" % name, getattr(m, "__file__", - "(built-in, frozen, or namespace)")) + if m.__spec__.has_location and hasattr(m, "__file__"): + print("%-35s" % name, getattr(m, "__file__")) + else: + print("%-35s" % name, "(%s)" % m.__spec__.origin) deps = sorted(self._depgraph[name]) text = "\n".join(textwrap.wrap(", ".join(deps))) print(" imported from:\n%s" % textwrap.indent(text, " ")) @@ -549,14 +547,16 @@ extension modules) """ - def __init__(self, loader, name, optimize): + def __init__(self, spec, name, optimize): self.__optimize__ = optimize self.__globalnames__ = set() self.__name__ = name - self.__loader__ = loader + self.__spec__ = spec self.__code_object__ = None + loader = self.__loader__ = spec.loader + if hasattr(loader, "get_filename"): # python modules fnm = loader.get_filename(name) @@ -569,6 +569,9 @@ self.__file__ = fnm if loader.is_package(name): self.__path__ = [os.path.dirname(fnm)] + elif spec.origin == "namespace": + # namespace modules have no loader + self.__path__ = spec.submodule_search_locations else: # frozen or builtin modules if loader.is_package(name): @@ -585,13 +588,12 @@ @property def __code__(self): - if self.__code_object__ is None: + if self.__code_object__ is None and self.__loader__ is not None: if self.__optimize__ == sys.flags.optimize: self.__code_object__ = self.__loader__.get_code(self.__name__) else: source = self.__source__ if source is not None: - # XXX??? for py3exe: __file__ = self.__file__ \ if hasattr(self, "__file__") else "<string>" try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2014-09-18 18:18:52
|
Revision: 753 http://sourceforge.net/p/py2exe/svn/753 Author: theller Date: 2014-09-18 18:18:44 +0000 (Thu, 18 Sep 2014) Log Message: ----------- Revert accidential commit Modified Paths: -------------- trunk/py2exe-3/py2exe/dllfinder.py trunk/py2exe-3/py2exe/mf34.py Modified: trunk/py2exe-3/py2exe/dllfinder.py =================================================================== --- trunk/py2exe-3/py2exe/dllfinder.py 2014-09-18 18:14:22 UTC (rev 752) +++ trunk/py2exe-3/py2exe/dllfinder.py 2014-09-18 18:18:44 UTC (rev 753) @@ -8,10 +8,7 @@ import os import sys -if sys.version_info >= (3, 4): - from . mf34 import ModuleFinder -else: - from . mf3 import ModuleFinder +from . mf3 import ModuleFinder from . import hooks ################################ Modified: trunk/py2exe-3/py2exe/mf34.py =================================================================== --- trunk/py2exe-3/py2exe/mf34.py 2014-09-18 18:14:22 UTC (rev 752) +++ trunk/py2exe-3/py2exe/mf34.py 2014-09-18 18:18:44 UTC (rev 753) @@ -1,4 +1,4 @@ -#!/usr/bin/python3.4 +#!/usr/bin/python3.3 # -*- coding: utf-8 -*- """ModuleFinder based on importlib """ @@ -14,7 +14,6 @@ import struct import sys import textwrap -import warnings # XXX Clean up once str8's cstor matches bytes. LOAD_CONST = bytes([dis.opname.index('LOAD_CONST')]) @@ -24,7 +23,31 @@ STORE_OPS = [STORE_NAME, STORE_GLOBAL] HAVE_ARGUMENT = bytes([dis.HAVE_ARGUMENT]) +# Monkeypatch some missing methods in Python 3.3's NamespaceLoader +def __patch_py33(): + if sys.version_info < (3, 4): + def is_package(self, fullname): + return True + def get_source(self, fullname): + return '' + + def get_code(self, fullname): + return compile('', '<string>', 'exec', dont_inherit=True) + + def init_module_attrs(self, module): + module.__loader__ = self + module.__package__ = module.__name__ + from importlib._bootstrap import NamespaceLoader + NamespaceLoader.is_package = is_package + NamespaceLoader.get_source = get_source + NamespaceLoader.get_code = get_code + NamespaceLoader.init_module_attrs = init_module_attrs + +__patch_py33() +del __patch_py33 + + class ModuleFinder: def __init__(self, path=None, verbose=0, excludes=None, optimize=0, ignores=None): @@ -56,11 +79,7 @@ """ assert "__SCRIPT__" not in sys.modules ldr = importlib.machinery.SourceFileLoader("__SCRIPT__", path) - if sys.version_info >= (3, 4): - spec = importlib.machinery.ModuleSpec("__SCRIPT__", ldr) - mod = Module(spec, "__SCRIPT__", self._optimize) - else: - mod = Module(ldr, "__SCRIPT__", self._optimize) + mod = Module(ldr, "__SCRIPT__", self._optimize) # Do NOT add it... # self._add_module("__SCRIPT__", mod) self._scan_code(mod.__code__, mod) @@ -76,8 +95,6 @@ raise TypeError("{0} is not a package".format(name)) for finder, modname, ispkg in pkgutil.iter_modules(package.__path__): self.safe_import_hook("%s.%s" % (name, modname)) - if ispkg: - self.import_package("%s.%s" % (name, modname)) def import_hook(self, name, caller=None, fromlist=(), level=0): @@ -281,27 +298,14 @@ msg = ('No module named {!r}; {} is not a package').format(name, parent) self._add_badmodule(name) raise ImportError(msg, name=name) - try: - spec = importlib.util.find_spec(name, path) - except ValueError as details: - # workaround for the .pth file for namespace packages that - # setuptools installs. The pth file inserts a 'damaged' - # module into sys.modules: it has no __spec__. Reloading - # the module helps (at least in Python3.4). - if details.args[0] == '{}.__spec__ is None'.format(name): - import imp - _ = __import__(name, path) - imp.reload(_) - spec = importlib.util.find_spec(name, path) - else: - raise - if spec is None: + loader = importlib.find_loader(name, path) + if loader is None: self._add_badmodule(name) raise ImportError(name) elif name not in self.modules: # The parent import may have already imported this module. try: - self._load_module(spec, name) + self._load_module(loader, name) except ImportError: self._add_badmodule(name) raise @@ -331,8 +335,8 @@ self.modules[name] = mod - def _load_module(self, spec, name): - mod = Module(spec, name, self._optimize) + def _load_module(self, loader, name): + mod = Module(loader, name, self._optimize) self._add_module(name, mod) if name in self._package_paths: mod.__path__.extend(self._package_paths[name]) @@ -477,10 +481,8 @@ print("P", end=" ") else: print("m", end=" ") - if m.__spec__.has_location and hasattr(m, "__file__"): - print("%-35s" % name, getattr(m, "__file__")) - else: - print("%-35s" % name, "(%s)" % m.__spec__.origin) + print("%-35s" % name, getattr(m, "__file__", + "(built-in, frozen, or namespace)")) deps = sorted(self._depgraph[name]) text = "\n".join(textwrap.wrap(", ".join(deps))) print(" imported from:\n%s" % textwrap.indent(text, " ")) @@ -547,16 +549,14 @@ extension modules) """ - def __init__(self, spec, name, optimize): + def __init__(self, loader, name, optimize): self.__optimize__ = optimize self.__globalnames__ = set() self.__name__ = name - self.__spec__ = spec + self.__loader__ = loader self.__code_object__ = None - loader = self.__loader__ = spec.loader - if hasattr(loader, "get_filename"): # python modules fnm = loader.get_filename(name) @@ -569,9 +569,6 @@ self.__file__ = fnm if loader.is_package(name): self.__path__ = [os.path.dirname(fnm)] - elif spec.origin == "namespace": - # namespace modules have no loader - self.__path__ = spec.submodule_search_locations else: # frozen or builtin modules if loader.is_package(name): @@ -588,12 +585,13 @@ @property def __code__(self): - if self.__code_object__ is None and self.__loader__ is not None: + if self.__code_object__ is None: if self.__optimize__ == sys.flags.optimize: self.__code_object__ = self.__loader__.get_code(self.__name__) else: source = self.__source__ if source is not None: + # XXX??? for py3exe: __file__ = self.__file__ \ if hasattr(self, "__file__") else "<string>" try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2017-08-01 13:55:51
|
Revision: 769 http://sourceforge.net/p/py2exe/svn/769 Author: theller Date: 2017-08-01 13:55:48 +0000 (Tue, 01 Aug 2017) Log Message: ----------- Add more MKL files to numpy_core hook, bump py2exe version. Modified Paths: -------------- trunk/py2exe-3/py2exe/__init__.py trunk/py2exe-3/py2exe/boot_ctypes_com_server.py trunk/py2exe-3/py2exe/hooks.py Modified: trunk/py2exe-3/py2exe/__init__.py =================================================================== --- trunk/py2exe-3/py2exe/__init__.py 2017-01-04 16:13:11 UTC (rev 768) +++ trunk/py2exe-3/py2exe/__init__.py 2017-08-01 13:55:48 UTC (rev 769) @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """py2exe package """ -__version__ = "0.9.2.5" +__version__ = "0.9.2.7" from .patch_distutils import patch_distutils Modified: trunk/py2exe-3/py2exe/boot_ctypes_com_server.py =================================================================== --- trunk/py2exe-3/py2exe/boot_ctypes_com_server.py 2017-01-04 16:13:11 UTC (rev 768) +++ trunk/py2exe-3/py2exe/boot_ctypes_com_server.py 2017-08-01 13:55:48 UTC (rev 769) @@ -53,7 +53,7 @@ def get_classes(module): return [ob for ob in module.__dict__.values() - if hasattr(ob, "_reg_progid_") + if hasattr(ob, "_reg_progid_") and ob._reg_progid_ is not None ] def build_class_map(): Modified: trunk/py2exe-3/py2exe/hooks.py =================================================================== --- trunk/py2exe-3/py2exe/hooks.py 2017-01-04 16:13:11 UTC (rev 768) +++ trunk/py2exe-3/py2exe/hooks.py 2017-08-01 13:55:48 UTC (rev 769) @@ -485,7 +485,9 @@ numpy_core_path = os.path.dirname(module.__loader__.path) #add mkl dlls from numpy.core, if present from os import listdir - dlls = [os.path.join(numpy_core_path,mkl) for mkl in listdir(numpy_core_path) if mkl.startswith('mkl_')] + dlls = [os.path.join(numpy_core_path,mkl) + for mkl in listdir(numpy_core_path) + if mkl.startswith('mkl_') or mkl in ['libmmd.dll', 'libifcoremd.dll', 'libiomp5md.dll']] for dll in dlls: finder.add_dll(dll) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |