[PEAK] py2exe?

alexander smishlajev alex at ank-sia.com
Tue Dec 13 00:52:22 EST 2005


John Fouhy wrote, at 13.12.2005 3:06:
> 
> Is it practical to use py2exe with a PEAK app?  I have looked at
> http://peak.telecommunity.com/DevCenter/DistributePeakApplications
> which uses the McMillan installer (does that still exist?) and is not
> very straight forward --- but that page is over 2 years old, now.
> 
> Has any progress been made since then?

yes, this february we've started to pack our application with py2exe.

it is not quite straightforward either, but it's doable.  you'll need to 
manually find peak modules you use and list them in py2exe "includes" 
option, and then you'll need to copy all needed data files (peak.ini, 
ZConfig schemas) into the library package.  here's how we do that:

     def _copy_ini_files(dist_class, collect_dir, files):
         _mkpath = dist_class.mkpath
         _copy_file = dist_class.copy_file
         for (dir, files) in files:
             target_dir = convert_path(dir)
             if not os.path.isabs(target_dir):
                 target_dir = os.path.join(collect_dir, target_dir)
             _mkpath(target_dir)
             for filename in files:
                 if not os.path.isfile(filename):
                     filename = config.packageFile(
                         dir.replace("/", "."), filename).filename
                 _copy_file(filename, target_dir)

     class py2exe_build(build_exe):
         def create_binaries(self, py_files, extensions, dlls):
             _copy_ini_files(self, self.collect_dir, ini_files)
             return build_exe.create_binaries(self,
                 py_files, extensions, dlls)

best wishes,
alex.




More information about the PEAK mailing list