From: <th...@us...> - 2014-09-24 17:47:59
|
Revision: 757 http://sourceforge.net/p/py2exe/svn/757 Author: theller Date: 2014-09-24 17:47:51 +0000 (Wed, 24 Sep 2014) Log Message: ----------- py2exe/dllfinder.py: Add Scanner.add_bootcode(code) method. The runtime compiles the code and adds it to the bootstrap code sequences. Modified Paths: -------------- trunk/py2exe-3/ChangeLog trunk/py2exe-3/py2exe/dllfinder.py trunk/py2exe-3/py2exe/mf3.py trunk/py2exe-3/py2exe/runtime.py Modified: trunk/py2exe-3/ChangeLog =================================================================== --- trunk/py2exe-3/ChangeLog 2014-09-24 17:33:35 UTC (rev 756) +++ trunk/py2exe-3/ChangeLog 2014-09-24 17:47:51 UTC (rev 757) @@ -1,5 +1,11 @@ 2014-09-24 <th...@ct...> + * py2exe/dllfinder.py: Add Scanner.add_bootcode(code) method. The + runtime compiles the code and adds it to the bootstrap code + sequences. This enables the hooks to do more fancy stuff. + +2014-09-24 <th...@ct...> + * Fix the 'ValueError: __loader__ is None' exception when a PEP 420 implicit namespace package is encountered. Modified: trunk/py2exe-3/py2exe/dllfinder.py =================================================================== --- trunk/py2exe-3/py2exe/dllfinder.py 2014-09-24 17:33:35 UTC (rev 756) +++ trunk/py2exe-3/py2exe/dllfinder.py 2014-09-24 17:47:51 UTC (rev 757) @@ -186,8 +186,13 @@ self._min_bundle = {} self._import_package_later = [] self._safe_import_hook_later = [] + self._boot_code = [] hooks.init_finder(self) + def add_bootcode(self, code): + """Add some code that the exe will execute when bootstrapping.""" + self._boot_code.append(code) + def set_min_bundle(self, name, value): self._min_bundle[name] = value Modified: trunk/py2exe-3/py2exe/mf3.py =================================================================== --- trunk/py2exe-3/py2exe/mf3.py 2014-09-24 17:33:35 UTC (rev 756) +++ trunk/py2exe-3/py2exe/mf3.py 2014-09-24 17:47:51 UTC (rev 757) @@ -306,7 +306,7 @@ except ValueError as details: # Python 3.4 raises this error for namespace packages if str(details) == "{}.__loader__ is None".format(name): - msg = "Error: Namespace packages are not yet supported: Skipping package {!r}" + msg = "Error: Namespace packages not yet supported: Skipping package {!r}" print(msg.format(name)) loader = None else: @@ -314,7 +314,7 @@ except AttributeError as details: # Python 3.3 raises this error for namespace packages if details.args == ("'module' object has no attribute '__loader__'",): - msg = "Error: Namespace packages are not yet supported: Skipping package {!r}" + msg = "Error: Namespace packages not yet supported: Skipping package {!r}" print(msg.format(name)) loader = None else: @@ -345,7 +345,6 @@ return module - def _add_badmodule(self, name): if name not in self.ignores: self.badmodules.add(name) Modified: trunk/py2exe-3/py2exe/runtime.py =================================================================== --- trunk/py2exe-3/py2exe/runtime.py 2014-09-24 17:33:35 UTC (rev 756) +++ trunk/py2exe-3/py2exe/runtime.py 2014-09-24 17:47:51 UTC (rev 757) @@ -562,6 +562,12 @@ optimize=self.options.optimize) code_objects.append(obj) + for text in self.mf._boot_code: + code_objects.append( + compile(text, + "<boot hacks>", "exec", + optimize=self.options.optimize)) + if target.exe_type == "service": # code for services # cmdline_style is one of: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |