Ronald Oussoren avatar Ronald Oussoren committed c21adfd

Earlier simplification of byte compilation code led to junk directories

An earlier check-in removed a special case for byte-compiling: source
files from the filesystem and source files from zipfiles are treated
the same. Sadly enough this used the code for zipped sources, which as
it turns out is broken and leads to junk directories on the fileystem.

This check-in fixes that problem.

Comments (0)

Files changed (2)

py2app/build_app.py

         self.eggs = []
 
     def finalize_options (self):
-        if sys.version_info[0] == 3:
-            if self.argv_emulation:
+        if self.argv_emulation:
+            if sys.version_info[0] == 3:
                 raise DistutilsOptionError("argv-emulation is not supported on python 3.x")
-        else:
-            if sys.maxint > 2 ** 32:
+            elif sys.maxint > 2 ** 32:
                 raise DistutilsOptionError("argv-emulation is not supported for 64-bit executables")
 
         if not self.strip:
                     
                 if not dry_run:
                     mkpath(os.path.dirname(cfile))
-                    mkpath(os.path.dirname(dfile))
                     suffix = os.path.splitext(mod.filename)[1]
 
                     if suffix in ('.py', '.pyw'):
-                        fn = dfile + '.py'
+                        fn = cfile + '.py'
 
                         fp_in = zipio.open(mod.filename, 'rb')
                         fp_out = open(fn, 'wb')
                         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.