[Distutils] Improving distutils' script and GUI app handling

Trent Mick trentm at ActiveState.com
Mon Sep 26 19:16:49 CEST 2005


[Phillip J. Eby wrote]
> > With Perl and Ruby, for example, scripts from a
> >3rd party package will be installed next to the main interpreter binary
> >(i.e. on the PATH) on all platforms. Would having setuptools (and
> >changing distutils) to install scripts next to python.exe wreak
> >unwarranted havoc?
> 
> Sadly, yes.  First of all, python.exe isn't *on* the PATH on Windows unless 
> you put it there yourself.

It gets on the PATH with ActivePython <wink>. I'd recommend that the
python.org Python installer do the same, but I seem to remember MvL (and
others?) stating their preference not to do so (don't recall why).

In any case, I'd say it is extremely *common* for Windows users to put
the Python install dir on their PATH -- just as it is common for Windows
Perl and Ruby users to put the interpreter dir on their PATH. I'd then
say that the obvious place to put user scripts installed via distutils
is that same directory.

> Second, the python.exe directory is on 
> sys.path, so it would turn your scripts into modules, conflicting with any 
> same-named modules.

That never occured to me that that could be a problem. I have a few
scripts that I've been distributing for a while and haven't had a
particular issue... because I tend to write so that my scripts are
(somewhat) useful as modules as well.

But you are right, some people could get surprised by this. Hrm. Either
(1) this behaviour (Python putting the interpreter dir on sys.path) is just
broken or (2) it was an intentional design and script-writers should be
expected to ensure their scripts either work reasonably or at least
don't cause damage when imported. Since the directory with the
interpreter is NOT on sys.path on other platforms (Linux, Un*x) then I'd
say this is just broken behaviour.

Anyone know, off hand, *why* the Python interpreter dir is on sys.path
on Windows?

Trent

-- 
Trent Mick
TrentM at ActiveState.com


More information about the Distutils-SIG mailing list