[Distutils] pythonv, take two

P.J. Eby pje at telecommunity.com
Sat Apr 2 17:08:29 CEST 2011

At 02:14 PM 4/1/2011 -0400, Carl Meyer wrote:
>But, as I mentioned, the fact that easy_install itself relies on finding
>site-packages relative to sys.prefix forces the issue - easy_install
>(including existing versions of it) needs to just work.

No, it doesn't, actually.

easy_install only uses sys.prefix to identify "site" directories 
without having to test them.  Its install paths actually come from 
the distutils -- so as long as the distutils "install" command has 
the right defaults, easy_install will work just fine.  (Assuming 
sys.executable is correct.)

What easy_install does if it's asked to install to a directory that:

1) doesn't look like a site directory (based on sys.prefix), and
2) isn't listed in --site-dirs on the command line or in the config files,

is that it runs a test (using sys.executable) to see if .pth files 
are actually supported in that directory.

So, if sys.prefix leads it to believe that the distutils-supplied 
target directory isn't really a "site" directory, it checks for 
itself whether it functions as a site directory.

In other words, easy_install will run a bit slower in such a scenario 
(due to the extra time taken to test), but still function 
correctly.  To stop it taking the extra time for the test, an 
additional command line option or configuration file option can be given.

More information about the Distutils-SIG mailing list