From: Tom P. <mlp...@ea...> - 2004-03-15 14:14:38
|
On Mar 15, 2004, at 12:00 AM, Roger Binns wrote: > On Mar 15, Tom Pollard wrote: >> Personally, I think that the startup script for BitPim should be a >> shell script, rather than a Python script. > > You should discuss this on bitpim-devel. On the other platforms, and > I had believed Mac as well, the binary distribution of BitPim includes > the Python interpretter and all modules needed (both ones written in > Python and the necessary shared libraries). I'm not sure how things are done on the other platforms, but I would have expected you to use the 'freeze' system for packaging a script as a standalone executable, similarly to 'perl2exe' and it's ilk. These systems package up the scripts, modules and dlls needed to run a script in a zip archive with a binary loader prepended. The loader is responsible for unpacking things, setting up the environment and executing your script using the bundled interpreter. This lets you run your script even if perl or python isn't installed at all on the target machine. The way BitPim's packaged for the Mac is simpler; MacOS X makes it easy to do something along the lines of perl2exe without actually using a single zip archive with a binary loader. But, you still need something like a loader to kick things off. For BitPim, that's a small Python script. This seems a little inelegant; since, this first script is the guy who sets things up so that subsequent python scripts can use the bundled python interpreter and modules, and so it requires the user to have a separate, working Python installation. From the recent problem report on the bitpim-user list, we saw that Python is an optional install on MacOS X. The BitPim startup script doesn't do anything that you can't do just as easily with a shell script, and a shell script would remove the need for a working Python on the user's machine. Anyway, this is just a suggestion. Most Mac BitPim users do seem to have Python installed. In any case, I've attached a shell script that could be used to replace the current BitPim python startup script. It uses a small shell function to extract the parent directory name from a filepath because the 'dirname' shell utility (like Python) is only there in MacOS X if the user installs the optional BSD package. Otherwise, it's just about line-for-line equivalent with the python version. Cheers, Tom |