This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Reorganize MacPython resources on OSX
Type: Stage:
Components: macOS Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jvr Nosy List: jackjansen, jvr
Priority: normal Keywords:

Created on 2002-10-19 21:13 by jackjansen, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (9)
msg12856 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2002-10-19 21:13
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').
msg12857 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-01-05 22:08
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.
msg12858 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-01-06 11:02
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).
msg12859 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-01-06 11:24
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).
msg12860 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-01-06 11:33
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?
msg12861 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-01-06 12:04
Logged In: YES 
user_id=45365

Yes, if you want to put some effort into this: please do!
msg12862 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-01-06 22:22
Logged In: YES 
user_id=92689

Ok, I've played around a bit and it's certainly doable: I
have a simple dialog running from a nib. It would still be a
fairly major rewrite of EasyDialogs as DialogRef's are not
supported in IBCarbon: must use straight windows.

One thing that's missing is the ability to load nibs from a
path, as opposed to finding them by name from an app bundle:
for this we need to create
Carbon.IBCarbon.CreateNibReferenceWithCFBundle(), and for
that to work we need CFBundle support in Carbon.CF.
msg12863 - (view) Author: Jack Jansen (jackjansen) * (Python committer) Date: 2003-02-25 13:34
Logged In: YES 
user_id=45365

Just, this error report has drifted quite a bit from the original intention: it was about splitting the .rsrc files into separate files living with the modules they belong to, but now it is about phasing out .rsrc files.

The former has been finished a while ago, how about closing this bug and opening a new one with a better title and description?
msg12864 - (view) Author: Just van Rossum (jvr) * (Python triager) Date: 2003-02-25 15:13
Logged In: YES 
user_id=92689

Sure. But I must warn you: my incentive to rewrite EasyDialogs using Carbon nibs has dropped to pretty much below zero...
History
Date User Action Args
2022-04-10 16:05:46adminsetgithub: 37343
2002-10-19 21:13:15jackjansencreate