From: Grant E. <gr...@vi...> - 2007-09-04 19:28:15
|
On 2007-08-29, Grant Edwards <gr...@vi...> wrote: > On 2007-08-29, Grant Edwards <gr...@vi...> wrote: >> On 2007-08-29, Thomas Heller <th...@ct...> wrote: >> >>> As I said, I would prefer the second solution; to rename the pyds >>> from 'package/name.pyd' to 'package.name.pyd'. >>> >>> Would you like to work on a patch? >> >> Yes. I've just started on it... > > OK, I've got a patch working. The patch against 0.6.6 is at ftp://ftp.visi.com/users/grante/python/py2exe-0.6.6-pyd-name-collision.patch It's also included below: ---------------------------------8<---------------------------------- Index: build_exe.py =================================================================== RCS file: /cvsroot/py2exe/py2exe/py2exe/build_exe.py,v retrieving revision 1.72 diff -U10 -r1.72 build_exe.py --- build_exe.py 22 Nov 2006 08:43:36 -0000 1.72 +++ build_exe.py 4 Sep 2007 19:20:13 -0000 @@ -400,21 +400,21 @@ self.mkpath(self.lib_dir) def copy_extensions(self, extensions): print "*** copy extensions ***" # copy the extensions to the target directory for item in extensions: src = item.__file__ if self.bundle_files > 2: # don't bundle pyds and dlls # XXX all dlls are copied into the same directory - a flat name space. # sooner or later that will give conflicts. - dst = os.path.join(self.lib_dir, os.path.basename(item.__file__)) + dst = os.path.join(self.lib_dir, (item.__pydfile__)) self.copy_file(src, dst, preserve_mode=0) self.lib_files.append(dst) else: # we have to preserve the packages package = "\\".join(item.__name__.split(".")[:-1]) if package: dst = os.path.join(package, os.path.basename(src)) else: dst = os.path.basename(src) self.copy_file(src, os.path.join(self.collect_dir, dst), preserve_mode=0) @@ -1071,25 +1071,35 @@ else: fname = os.path.join(os.path.dirname(sys.executable), "w9xpopen.exe") # Don't copy w9xpopen.exe if it doesn't exist (64-bit # Python build, for example) if os.path.exists(fname): dlls.add(fname) def create_loader(self, item): # Hm, how to avoid needless recreation of this file? pathname = os.path.join(self.temp_dir, "%s.py" % item.__name__) + if self.bundle_files > 2: # don't bundle pyds and dlls + # all dlls are copied into the same directory, so + # modify names to include original path to avoid + # name conflicts and tuck it away for future reference + fname = item.__file__ + fname = fname.replace(":","_") + fname = fname.replace("\\",".") + item.__pydfile__ = fname + else: + fname = os.path.basename(item.__file__) + # and what about dry_run? if self.verbose: - print "creating python loader for extension '%s'" % item.__name__ + print "creating python loader for extension '%s' (%s -> %s)" % (item.__name__,item.__file__,fname) - fname = os.path.basename(item.__file__) source = LOADER % fname if not self.dry_run: open(pathname, "w").write(source) else: return None from modulefinder import Module return Module(item.__name__, pathname) def plat_prepare(self): self.includes.append("warnings") # needed by Python itself ---------------------------------8<---------------------------------- |