|
From: <th...@us...> - 2014-09-24 17:33:49
|
Revision: 756
http://sourceforge.net/p/py2exe/svn/756
Author: theller
Date: 2014-09-24 17:33:35 +0000 (Wed, 24 Sep 2014)
Log Message:
-----------
Fix the 'ValueError: __loader__ is None' exception when a PEP 420
implicit namespace package is encountered; instead print an error
message about unsupported namespace packages.
Fixed: When running in a virtual environment, py2exe did
not copy the tcl/tk files when 'import tkinter' is detected.
Ignore 'numpy.core._dotblas' when numpy.core is imported.
Modified Paths:
--------------
trunk/py2exe-3/ChangeLog
trunk/py2exe-3/TODO.txt
trunk/py2exe-3/py2exe/hooks.py
trunk/py2exe-3/py2exe/mf3.py
trunk/py2exe-3/py2exe/runtime.py
Modified: trunk/py2exe-3/ChangeLog
===================================================================
--- trunk/py2exe-3/ChangeLog 2014-09-23 12:58:15 UTC (rev 755)
+++ trunk/py2exe-3/ChangeLog 2014-09-24 17:33:35 UTC (rev 756)
@@ -1,3 +1,13 @@
+2014-09-24 <th...@ct...>
+
+ * Fix the 'ValueError: __loader__ is None' exception when a PEP
+ 420 implicit namespace package is encountered.
+
+ * Fixed: When running in a virtual environment, py2exe did
+ not copy the tcl/tk files when 'import tkinter' is detected.
+
+ * Ignore 'numpy.core._dotblas' when numpy.core is imported.
+
2014-09-18 <th...@ct...>
* py2exe/mf3.py (ModuleFinder.import_package): enumerate and
Modified: trunk/py2exe-3/TODO.txt
===================================================================
--- trunk/py2exe-3/TODO.txt 2014-09-23 12:58:15 UTC (rev 755)
+++ trunk/py2exe-3/TODO.txt 2014-09-24 17:33:35 UTC (rev 756)
@@ -5,8 +5,9 @@
These occur when ModuleFinder encounters an implicit namespace
package.
- First step: Catch this case and display a message (which includes
- the package name) that namespace packages are not yet supported.
+ Fixed in rev. 755:
+ First step: Catch this case and display a message (which includes
+ the package name) that namespace packages are not yet supported.
Second step: Make namespace packages work. Actually they occur in
two separate cases - the first one is matplotlib.mpl_toolkit which
@@ -32,13 +33,6 @@
- py2exe does not detect imports from six.moves.
-- tkinter programs will not build in virtual environments.
-
- The problem is that the tcl directory in the system installation is
- used; there is only a init.tcl file present in the virtual
- environment. How can we detect this case and find the correct files
- to copy?
-
- Implement a separate modulefinder for Python 3.4 and above which
uses the PEP451 ModuleSpec type and avoids calling deprecated apis.
@@ -47,13 +41,17 @@
================================================================
-Fixed in rev. 751: Enumerate subpackages and import all modules from
-the recursively:
- - ModuleFinder.import_package() should either work recursively
- (have to check what py2exe for Python2 does) or get a receursive
- parameter.
+Fixed in rev. 755: When running in a virtual environment, py2exe did
+ not copy the tcl/tk files when 'import tkinter' is detected.
+Fixed in rev. 755: When ModuleFinder encounters a PEP 420 implicit
+ namespace package 'ValueError: __loader__ is None' exception is
+ no longer raised; instead an error message is printed.
+
+Fixed in rev. 751: ModuleFinder.import_package enumerates subpackages
+ and imports modules from them recursively.
+
================================================================
Have to check which of the following is still needed:
Modified: trunk/py2exe-3/py2exe/hooks.py
===================================================================
--- trunk/py2exe-3/py2exe/hooks.py 2014-09-23 12:58:15 UTC (rev 755)
+++ trunk/py2exe-3/py2exe/hooks.py 2014-09-24 17:33:35 UTC (rev 756)
@@ -158,7 +158,9 @@
"""
# It probably doesn't make sense to exclude tix from the tcl distribution,
# and only copy it when tkinter.tix is imported...
- tcl_dir = os.path.join(sys.prefix, "tcl")
+ import tkinter._fix as fix
+ tcl_dir = os.path.normpath(os.path.join(fix.tcldir, ".."))
+ assert os.path.isdir(tcl_dir)
finder.add_datadirectory("tcl", tcl_dir, recursive=True)
finder.set_min_bundle("tkinter", 2)
@@ -166,7 +168,7 @@
finder.set_min_bundle("PySide", 3)
def hook_six(finder, module):
- """six.py is a python2/python3 compaibility library. Exclude the
+ """six.py is a python2/python3 compatibility library. Exclude the
python2 modules.
"""
finder.ignore("StringIO")
@@ -180,6 +182,8 @@
"mpl-data")
finder.add_datadirectory("mpl-data", mpl_data_path, recursive=True)
finder.excludes.append("wx")
+ # XXX matplotlib requires tkinter which modulefinder does not
+ # detect because of the six bug.
def hook_numpy(finder, module):
"""numpy for Python 3 still tries to import some Python 2 modules;
@@ -345,3 +349,6 @@
module.__globalnames__.add("int32")
module.__globalnames__.add("number")
module.__globalnames__.add("single")
+
+def hook_numpy_core(finder, module):
+ finder.ignore("numpy.core._dotblas")
Modified: trunk/py2exe-3/py2exe/mf3.py
===================================================================
--- trunk/py2exe-3/py2exe/mf3.py 2014-09-23 12:58:15 UTC (rev 755)
+++ trunk/py2exe-3/py2exe/mf3.py 2014-09-24 17:33:35 UTC (rev 756)
@@ -301,7 +301,24 @@
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)
+ try:
+ loader = importlib.find_loader(name, path)
+ 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}"
+ print(msg.format(name))
+ loader = None
+ else:
+ raise
+ 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}"
+ print(msg.format(name))
+ loader = None
+ else:
+ raise
if loader is None:
self._add_badmodule(name)
raise ImportError(name)
Modified: trunk/py2exe-3/py2exe/runtime.py
===================================================================
--- trunk/py2exe-3/py2exe/runtime.py 2014-09-23 12:58:15 UTC (rev 755)
+++ trunk/py2exe-3/py2exe/runtime.py 2014-09-24 17:33:35 UTC (rev 756)
@@ -200,8 +200,8 @@
if errors:
print("The following modules require a minimum bundle_files option,")
- print("otherwise they will not work.")
- print("Currently bundle_files is set to %d:\n" % self.options.bundle_files)
+ print("otherwise they will not work (currently bundle_files is set to %d):"
+ % self.options.bundle_files)
for name, value in errors:
print(" %s: %s" % (name, value))
print("\nPlease change the bundle_files option and run the build again.")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|