[PEAK] py2exe?
John Fouhy
john at fouhy.net
Wed Dec 14 20:35:06 EST 2005
On 13/12/05, alexander smishlajev <alex at ank-sia.com> wrote:
> 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)
Hi Alex,
Thanks for your reply. Can I ask some questions about your code?
> class py2exe_build(build_exe):
Does this follow the pattern from this page? -
http://starship.python.net/crew/theller/moin.cgi/SubclassingPy2Exe
> filename = config.packageFile(dir.replace("/", "."), filename).filename
What is config?
> _copy_ini_files(self, self.collect_dir, ini_files)
ini_files - is that a list you specified yourself?
(like "ini_files = ['c:/foo/peak.ini']" ?)
--
John.
More information about the PEAK
mailing list