[Distutils] EasyInstall: scripts

Bob Ippolito bob at redivi.com
Mon May 30 02:13:06 CEST 2005


On May 29, 2005, at 5:01 PM, Phillip J. Eby wrote:

> At 04:43 PM 5/29/2005 -0700, Bob Ippolito wrote:
>
>> On May 29, 2005, at 3:46 PM, Phillip J. Eby wrote:
>>
>>> It might help if there were some kind of metadata for scripts,  
>>> like to
>>> indicate whether something is a command-line utility, a graphical
>>> application, etc.  Then distutils could tweak the file extension
>>> and/or
>>> build a custom launcher for it (like Fredrik Lundh's exemaker for
>>> Windows)
>>> as appropriate for the platform.  That information could then be
>>> added to
>>> EGG-INFO and/or EGG-SCRIPTS, and used by EasyInstall to do script
>>> installation and uninstallation.
>>>
>>
>> Couldn't you change build_scripts and install_scripts when using
>> bdist_egg to instead put the script inside the egg somewhere, and the
>> installer would put scripts in the usual places that simply require
>> and then exec the real script?
>>
>
> That's more or less what I was proposing, except that I wouldn't  
> use build_scripts or install_scripts, just pack the original source  
> scripts into the egg, and then let the installer do its thing at  
> the other end.  That way, a cross-platform egg wouldn't have any  
> platform-specific stuff baked into the scripts accidentally.
>
> It's not as if build_scripts or install_scripts do anything of  
> consequence at the moment anyway; they just munge the #! line and  
> copy the files (as of Python 2.3 anyway).

I guess, I don't think it really matters.  If platform specific stuff  
gets baked into the scripts somehow, then they probably won't work  
without it.  The #! line is of course of no consequence in-egg.

> My main thought is distinguishing console vs. GUI start scripts.  I  
> don't believe there's a Mac equivalent to '.pyw', for example.   
> Also, at some point EasyInstall really could support adding desktop  
> shortcuts (or Start menu entries or whatever you call them on a  
> given platform) for applications bundled in eggs.  Sort of an end- 
> user py2exe/py2app thing.

There is a Mac equivalent to '.pyw', it's the same thing (except .py  
files don't normally launch with a terminal attached, so really all  
Python scripts are treated as .pyw .. which is probably a bug).

Mac OS X doesn't condone applications touching the user's dock, so  
the "start menu" thing is out.  As for putting the applications in a  
reasonable place, the "reasonable place" depends on the user.  The  
best solution might be to just pop open the dist folder and let the  
user drag it to where they want it, or to put it in a disk image and  
mount it.

Anyway, "GUI scripts" is mostly a non-starter on OS X, it's generally  
not the right thing to do.  Things should either be applications or  
not.  Python doesn't currently participate in the "script"  
infrastructure on Mac OS X.

> On the other hand, it does seem a little silly to use a command- 
> line tool to install a graphical application.  :)  However, it  
> probably makes sense to create platform-specific GUI wrappers  
> around EasyInstall to do this sort of thing.

Well, on Mac OS X, you don't install graphical applications, they're  
self-contained application bundles that you just put wherever you  
want and run.  Installers, on Mac OS X, are for crappy applications  
that don't do things the right way.

-bob



More information about the Distutils-SIG mailing list