[Pythonmac-SIG] [Numpy-discussion] Packaging numpy with py2app
Josh Marshall
josh.p.marshall at gmail.com
Tue Jul 18 23:36:06 CEST 2006
On 18/07/2006, at 3:15 PM, Bob Ippolito wrote:
>> def check(cmd, mf):
>> m = mf.findNode('matplotlib')
>> if m is None or m.filename is None:
>> return None
>> mf.import_hook('pytz.zoneinfo', m, ['UTC'])
>> return dict(
>> packages = ['matplotlib']
>> )
>>
>> If anyone needs to actual work with the plotting of time-zone
>> relative dates in matplotlib in embedded Cocoa, it'll die.
>> However, the likelihood of this occurring is low, but for future
>> reference for the Googlers of the future; add the time-zones you
>> need to the list in import_hook, ie ['UTC', 'Australia.Sydney'].
>
> If you were actually doing that, you should write the imports
> yourself. The right place to put that metadata is in your code with
> import statements, because that's cross-platform and cross-
> packager. py2exe and cx_Freeze will understand import statements too.
Agreed. I searched through matplotlib and pytz, and found that you
can add a straightforward import of pytz.zoneinfo.UTC rather than
going through a loader function. I will submit as a patch to the
matplotlib developers. I suggest leaving the line in the recipe for a
while at least.
> You can't do that so long as scipy is wholly included with the
> packages option. The packages option does "cp -r" effectively, I'm
> not going to complicate it for this use case. I might accept a
> patch if it wasn't too horrible, but the effort is better spent
> making scipy work in a zip archive.
Agreed, although with the latest version of py2app working out of the
box with the recipes, I'll probably let it slide.
I spent a bit more time looking at matplotlib, and realised I just
need to include the data files (fonts, rc, icons) directory in the
Resources dir in the app. When I did this manually, it worked fine,
since there is code to detect frozen status in the initialisation,
and it searches the Resources dir.
However, I can't figure out how to copy resources in the recipe. It
seems in recipes, you can return in the dict: packages, flatpackages,
filters, loader_files, and prescripts. Could you enlighten me on the
use of each of these?
Regards,
Josh
More information about the Pythonmac-SIG
mailing list