Ronald Oussoren avatar Ronald Oussoren committed da8a05a

Workaround for a crash when building a bundle that includes
a python package that has a zipfile in its package directory.

The fix to py2app.build_app is rather crude, and as the
comment says it needs to be fixed in modulegraph.zipio instead.
That requires an API change and that in turn requires a review
of all current uses of that API.

Also remove a debug statement.

Comments (0)

Files changed (3)

doc/changelog.rst

 
 Bugfixes:
 
+- py2app failed to build the bundle when python package contained
+  a zipfile with data.
+
+  This version solves most of that problem using a rough
+  workaround (the issue is fixed when the filename ends with '.zip').
+
 - The code that recreates the stub executables when they are
   older than the source code now uses ``xcode-select`` to 
   find the root of SDKs.

py2app/build_app.py

                 pth = os.path.join(dname, fname)
 
                 # Check if we have found a package, exclude those
-                if zipio.isdir(pth):
+                if zipio.isdir(pth) and not pth.endswith('.zip'):
+                    # XXX: the 'and not' part is wrong, need to fix zipio.isdir
                     for p in zipio.listdir(pth):
                         if p.startswith('__init__.') and p[8:] in exts:
                             break
                         fp_in.close()
                         fp_out.close()
 
-                        print "XXX byte-compiling fn=%s cfile=%s dfile=%s"%(fn, cfile, dfile)
                         compile(fn, cfile, dfile)
                         os.unlink(fn)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.