[Pythonmac-SIG] creating file associations with apps via bundlebuilder?

Bob Ippolito bob at redivi.com
Wed Aug 18 17:30:58 CEST 2004


On Aug 18, 2004, at 10:54 AM, Kevin Altis wrote:

> On Aug 17, 2004, at 11:10 PM, Bob Ippolito wrote:
>
>> On Aug 17, 2004, at 8:50 PM, Kevin Altis wrote:
>>
>>> I have a few bundlebuilder scripts that all seem to be making  
>>> standalones from my PythonCard/wxPython scripts just fine, so thanks  
>>> to Bob, etc. for that. However, I can't figure out what I need to do  
>>> to get file extension assocations for those apps. For example, the  
>>> CodeEditor standalone should be able to open .txt, .text, .xml,  
>>> .htm, .html, .py, and .pyw at a minimum. If I try and choose the  
>>> CodeEditor app I built via the Finder Get Info dialog with a .py  
>>> file it doesn't think CodeEditor is a recommended application. So,  
>>> I'm assuming there is some .plist file I have to create as well or  
>>> do some other magic?
>>
>> Yes, Info.plist.  It's not magic, everything that LaunchServices  
>> knows about is in that one file.
>>
>> http://developer.apple.com/documentation/MacOSX/Conceptual/ 
>> BPRuntimeConfig/Concepts/PListKeys.html#//apple_ref/doc/uid/20001431/ 
>> TPXREF107
>>
> Thanks. I cobbled together my own Info.plist file using PythonIDE and  
> SubEthaEdit and the doc page as examples. I have a script that I've  
> been using to make the standalone rather than providing a whole lot of  
> command-line args to bundlebuilder. I've included the script below in  
> case it points out some fundamental mistake on my part. I can't figure  
> out a way to provide my own Info.plist file as a variable. Glancing at  
> the bundlebuilder.py script it looks like I would have to read in and  
> parse the Info.plist file using plistlib.PlistParser before setting  
> the parsed XML to myapp.plist? Is there another way?

Yes, you should pass it a plistlib instance, which you can get from  
opening the file and parsing it with plistlib.  There's also a command  
line argument that will take a plist file.

Note that AppBuilder takes keyword arguments like distutils.  That is  
the preferred way to pass in arguments rather than setting them on the  
object.  I think some initialization may happen in __init__.

bundlebuilder2 can detect those dependencies automatically.. well, not  
the rsrc file, but the dylibs.  It also rewrites the Mach-O load  
commands so that they point to the right place.  I think the last  
working version is at:
http://undefined.org/python/macholib-v2.0a0.tgz

-bob


More information about the Pythonmac-SIG mailing list