Re: [Pyobjc-dev] buildapplication strawman
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2002-11-19 17:07:05
|
Jack Jansen wrote: > > But you don't do anything with the pathname but get the base name, > > strip the extension and use it as the NSMainNibFile Info.plist key, > > right? Why not just write "MainMenu" and be done with it? > > Yes, it's added to the resources. Ah, I now see your "The .lproj or > individual nibs should then be listed as a resource" sentence. So you > want the user to pass the main nib twice, once as a file and once as > a name. Hmm, yes, with nibs in ..lprojs I can see the point. Ok, fine > with me, but you should probably add a check that the main nib > actually exists. I read your code, and it just picks an arbitrary nib if there are more than one, I don't quite understand how you can defend that... [I don't quite get Bill's comment regarding this, we're assembling an app, not _using_ nibs, so I don't see the relevance of the system API's here.] > > BuildApplet is great for very simple things, and worked fine on OS9 > > where everything you needed could live in <scriptname>.rsrc. But I > > don't think this approach is all that useful for .app bundles but > > for the simplest of scripts. Then again: BuildApplet-like > > functionality could easily be built on top of this. > > But don't forget that there are many "very simple things". About 100% > of the scripts ported over from unix, for instance. But as I said: if > you're writing the code you decide how to do it. I find it very limiting in reality: as soon as a unix script has options the argv emulation is hardly useful. > > My working code currently needs to munge the wrapper even more: I > > need to specify the Python executable in case it's copied to > > Contents/Resources/. It's a tiny amount of code and works for me > > just fine as a triple-quoted string. [Reading this back: I need to > > do even more if we need to set PYTHONHOME conditionally.] > > Could be done dynamically: > bindir = os.path.split(argv[0])[0] > if os.path.exists(os.path.join(bindir, "python")): > We are a self-contained application, set PYTHONHOME and use > this python > else: > We are an applet. Set PYTHONPATH and use /usr/bin/python Ok, that's an option. But I don't really like runtime checks for things that are known at build time, and I really don't see any problem with using a tiny triple-quoted string as template. > > The stuff I would _especially_ like to avoid is the Mac-specific > > main, with __main__/__rawmain__ magic. I want to use the vanilla > > unix main, or rather the vanilla unix _executable_. Trivial with > > the execve template. > > But unfortunately the __rawmain__ trick is needed for one of the most > useful applications of an applet: taking a standard unix Python > script and turning it into a droplet. Don't you want to move the argv emulation to Python as well? It's hairy stuff and I think we could win a great deal to have it in Python. I really think we should strive to use a vanilla main, and the execve wrapper makes it all possible. Just |