[Distutils] EasyInstall: scripts

Bob Ippolito bob at redivi.com
Mon May 30 01:43:54 CEST 2005

On May 29, 2005, at 3:46 PM, Phillip J. Eby wrote:

> At 03:56 PM 5/29/2005 -0500, Ian Bicking wrote:
>> I'm wondering how scripts should be handled by easyinstall --  
>> right now
>> they pretty much get ignored.  But I'm not sure how they should be
>> handled at all.  Distutils has a couple rules, with --install- 
>> scripts,
>> and --home (which uses ~/bin), and the normal rules... and then some
>> translation of those options to Windows.  But none of those seems to
>> translate very well to easyinstall.  Or eggs.
>> I don't have any ideas myself on this.  Except that the scripts
>> themselves are usually pretty dumb anyway, just thin wrappers that  
>> fix
>> up sys.path, import a module, and call a function; so the status quo
>> could probably be improved upon anyway.
> Yep.  Like you, however, I'm not sure what to do about 'em.  Take a  
> look at
> the Unix versions of easy_install -- they're actually the regular .egg
> files, with a shell script cat'ted on at the front!  (Somebody could
> probably pull the same trick with an .exe on Windows.)
> However, such "eggsecutables" aren't really a solution for packages  
> with
> multiple scripts.  I'm thinking maybe bdist_egg should include an
> EGG-SCRIPTS directory for the scripts, so that EasyInstall could  
> pull them
> out and install them whenever you do a non --multi-version  
> install.  It
> would, however, also need to *uninstall* them when deactivating a  
> current
> version, because otherwise they'd be for the wrong version.
> I had previously thought that we would move towards using "python - 
> m" to
> run scripts in eggs; unfortunately this only works for unpacked  
> eggs, not
> egg files.
> Of course, this all just overlaps the fact that distutils script
> installation is really only good for command-line utilities anyway,  
> and
> even for those, Windows requires a fair bit of tweaking in order to  
> be able
> to use them effectively at a non-Cygwin command line.
> 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?


More information about the Distutils-SIG mailing list