[Distutils] Enabling local distutils.cfg usage

Phillip J. Eby pje at telecommunity.com
Tue Oct 9 20:01:44 CEST 2007


At 12:05 PM 10/9/2007 -0400, Tres Seaver wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Ian Bicking wrote:
> > Tres Seaver wrote:
> >> When building a virtual environment, I'd like to be able to store
> >> global distutils configuration options which are custom to that
> >> environment.  However, both setuptools and distutils expect to
> >> read / write that file relative to the directory of
> >> 'distutils.__file__', which is located in the *source*
> >> environment under virtualenv 0.8.4::
> >
> > This should be working in virtualenv trunk; I had to switch up the way
> > sys.path was constructed some, because the way it was the system path
> > came before the virtualenv path, so a virtual distutils wouldn't be seen.
>
>Cool. Where is the trunk SVN, by the way?

By the way, at OSAF we had a similar issue recently with needing a 
local distutils.cfg; the recipe for creating a simple "virtual 
distutils" in case anyone needs it is:

distutils.py:
__path__ = ['/path/to/the/real/distutils']  # yes, it ends with 'distutils'
from distutils.__init__ import __version__, __revision__, __doc__

You can then put a distutils.cfg alongside it, in a directory that's 
on sys.path *before* the real disutils.  (And you'll need, of course, 
to know where the real distutils is.)



More information about the Distutils-SIG mailing list