Hello Jimmy,

enjoying all your work with keeping py2exe modernized, today I installed py2exe 0.65

My old setup.py kept working, which was a joy!!!  untill.... I wanted to use the new "skip-archive" option.

my setup.py is basically an extension of the extending example; and here the trouble begins:

"Extending" contains methods to create a innosetup-installer-skript
that create-method has one section:

for path in self.windows_exe_files + self.lib_files:
     print >> ofi, r'Source: "%s"; DestDir: "{app}\%s"; Flags: ignoreversion' % (path, os.path.dirname(path))

that is, every file in windows_exe_files and self.lib_files is copied...... because innosetup has to "compress" them into the installer.

NOW with skip-archiv the trouble begins:

build_exe.py contains the method

def make_lib_archive(self, zip_filename, base_dir, files,
                         verbose=0, dry_run=0):

if not self.skip_archive:
else: return "."
this "single dot" "." gets appended to self.lib_files. OF COURSE, "." is not really an archive file, so on trying to copy it into an installer, that fails BADLY.

Worse ... this "." stands for all the .pyo or .pyc files, which SHOULD be distributed :))) So, simply stripping the "." from lib_files makes a not working installer.

I changed make_lib_archive to the following:
    def make_lib_archive(self, zip_filename, base_dir, files,
                         verbose=0, dry_run=0):
        from distutils.dir_util import mkpath
        if not self.skip_archive:
            # Like distutils "make_archive", but we can specify the files
            # to include, and the compression to use - default is
            # ZIP_STORED to keep the runtime performance up.  Also, we
            # don't append '.zip' to the filename.
            mkpath(os.path.dirname (zip_filename), dry_run=dry_run)

            if self.compressed:
                compression = zipfile.ZIP_DEFLATED
                compression = zipfile.ZIP_STORED

            if not dry_run:
                z = zipfile.ZipFile(zip_filename, "w",
                for f in files:
                    z.write(os.path.join(base_dir, f), f)

            return zip_filename
            # Don't really produce an archive, just copy the files.
            from distutils.file_util import copy_file

            destFolder = os.path.dirname(zip_filename)
            self.destcopiedFiles=[]  #HAM added
            for f in files:
                d = os.path.dirname(f)
                if d:
                    mkpath(os.path.join(destFolder, d), verbose=verbose, dry_run=dry_run)
                destpath=os.path.join(destFolder, f)
                          os.path.join(base_dir, f),
                self.destcopiedFiles.append(destpath) #HAM added
            return "."

and before I pass the "self.lib_files" to the create method, I put in

        if '.' in self.lib_files:

that works. I am happy. But it looks like a very very crude hack. And will be gone with the next version of py2exe ... unless you can incorporate some of this fix within the core :)

If I can be of any help, please let me know!


GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Reinsburgstra├če 202b
70197 Stuttgart
PostgreSQL - supported by a community that does not put you on hold