[Python-bugs-list] [ python-Bugs-625725 ] Reorganize MacPython resources on OSX

SourceForge.net noreply@sourceforge.net
Mon, 06 Jan 2003 04:04:37 -0800


Bugs item #625725, was opened at 2002-10-19 23:13
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=625725&group_id=5470

Category: Macintosh
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jack Jansen (jackjansen)
Assigned to: Just van Rossum (jvr)
Summary: Reorganize MacPython resources on OSX

Initial Comment:
The resource file for Python on OSX should be reorganized. Some of the resources are only used by specific modules such as EasyDialogs, these should go into private resource files. Some are used by the interpreter itself (The "Estr" resource that maps error numbers to strings comes to mind). The most obvious place for these would be the resource file of the framework, but these may also be useful in non-framework builds (where you now get the uninformative 'MacOS.Error: Error -1234').

----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2003-01-06 13:04

Message:
Logged In: YES 
user_id=45365

Yes, if you want to put some effort into this: please do!

----------------------------------------------------------------------

Comment By: Just van Rossum (jvr)
Date: 2003-01-06 12:33

Message:
Logged In: YES 
user_id=92689

Wait, there already is Carbon.IBCarbon, cool! Shall I try to
find out what it takes to convert EasyDialogs to use it?

----------------------------------------------------------------------

Comment By: Just van Rossum (jvr)
Date: 2003-01-06 12:24

Message:
Logged In: YES 
user_id=92689

Ok, I checked in a change to macresource.py to this effect
(it simply adds sys.path to searchdirs, after
os.path.dirname(__file__).

Apart from Estr, how about trying to use nibs instead of res
files? I think this is meant to work for OS9 as well, but
would require interfacing some *FromNib API's in Carbon.Win
and Carbon.Dlg. Just a thought.

Either way, we should use a strict naming convention, eg.
EasyDialogs.py's resources should be in a file called
EasyDialogs.rsrc (and/or EasyDialogs.nib if we take the
above route).

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2003-01-06 12:02

Message:
Logged In: YES 
user_id=45365

Okay with me, as long as you look on sys.path *after* checking the __file__. So the order would be
1) Check wheter it happens to be available already
2) Check whether __file__ gives a clue
3) check sys.path

An alternative solution would be that bundlebuilder takes the .rsrc file for each module automatically and combines them all (including errors.rsrc)into the resource file that is automatically opened when the .app starts (I think it's <executablename>.rsrc, check the apple docs).

A Python module in stead of the Estr resource I'm not too thrilled about: there are a lot of error messages, and if it was a Python module then they would all be in-core once you import the module.

I'm assigning this over to you, close it when you're done (the rest of the reorganization is finished).

----------------------------------------------------------------------

Comment By: Just van Rossum (jvr)
Date: 2003-01-05 23:08

Message:
Logged In: YES 
user_id=92689

The Estr resource: is this resource generated, and if so
how? Would it be  an idea to generate a Python module instead?

The macresource module also has issues: eg. for EasyDialogs
it looks for "dialogs.rsrc" in
os.path.dirname(EasyDialogs.__file__), which doesn't work
when EasyDialogs is loaded from a zip file. If it would
(additionally) look on sys.path it could work for standalone
apps created by bundlebuilder: it should simply be included
in <appname>.app/Contents/Resources/ then.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=625725&group_id=5470