[PEAK] Packaging peak apps
Roché Compaan
roche at upfrontsystems.co.za
Wed Sep 29 08:39:32 EDT 2004
Phillip J. Eby wrote:
> At 10:31 AM 9/28/04 +0200, Roché Compaan wrote:
>
>> Phillip J. Eby wrote:
>>
>>> At 10:43 AM 9/27/04 +0200, Roché Compaan wrote:
>>>
>>>> Basically the peak script:
>>>>
>>>> from peak.running import commands
>>>> commands.runMain( commands.Bootstrap )
>>>>
>>>> I am building an exe from run.py with py2exe for testing purposes. I
>>>> end up with run.exe. I get the traceback when calling run.exe from
>>>> the command line.
>>>
>>>
>>> And this is with an up-to-date CVS version of PEAK? And
>>> 'peak/binding/__init__.py' and 'peak/binding/interfaces.py' are in
>>> the zipfile bound to run.exe?
>>
>>
>> Yep.
>>
>>> Better yet... can you give me a location to download your run.exe so
>>> I can investigate? Thanks.
>>
>>
>> Attached is a zip of the whole "dist" directory, containing
>> library.zip and run.exe.
>
>
> As far as I can tell, the issues are caused by the lack of reloading
> support for zipfiles, coupled with the absence of various required
> modules from library.zip. (For example, library.zip doesn't contain
> peak.binding.api, so that doesn't work.)
>
> Also note that even if your script got to the second line, it would then
> run afoul of the fact that 'config.fileNearModule()' will be broken when
> the modules are in a zipfile.
>
> Really, to run from a zipfile, you not only need the currently
> non-existent Python 2.3.5, but also a version of PEAK that doesn't use
> fileNearModule() in its present form.
>
> My recommendation to you is to try using the procedure at:
>
> http://peak.telecommunity.com/DevCenter/DistributePeakApplications
>
> but simply delete the .py files to obfuscate the source.
>
> If you can't use this approach, you might try having your application
> extract library.zip to a library directory (if it isn't already), and
> then replace 'library.zip' in sys.path with the name of the library
> directory before doing any other imports. This isn't perfect, but it
> might do the trick if you don't want to build your own executable as
> described on the Wiki.
It does! And it is fairly simple to do. I basically built the distro
with py2exe, extracted library.zip to a folder named library.zip and
copied in missing packages and modules. I've only tested this by making
an exe for the peak script and it seems to work fine.
--
Roché Compaan
Upfront Systems http://www.upfrontsystems.co.za
More information about the PEAK
mailing list