[Distutils] setuptools: hardcoding the path in a script and site.py

Ian Bicking ianb at colorstudy.com
Thu May 18 22:34:07 CEST 2006

Ian Bicking wrote:
> The other monkeypatch I'm doing is to keep setuptools from demanding to 
> own site.py.  The monkeypatch is:
>    def install_site_py(self):
>        # to heck with this, we gots our own site.py and we'd like
>        # to keep it, thank you
>        pass
>    easy_install.easy_install.install_site_py = install_site_py
> But what would be better is if setuptools installed code somewhere 
> besides site.py.  For instance, site-setuptools.py.  Then if site.py 
> didn't exist, it would be created like:
>    import os
>    # add site-setuptools
>    execfile(os.path.join(os.path.dirname(__file__), 'site-setuptools.py')
> If the file did exist, setuptools would check for the text "add 
> site-setuptools", and give a warning or error if it was not, or maybe 
> would just prefix the site.py with this text, and leave the rest of it 
> as is.  Then I'd include that code in workingenv's site.py.

I should note that even if the monkeypatch for path setting remains 
necessary a while longer, this monkeypatch actually causes me more 
grief.  So if setuptools fixed this, that would be even better.  And I 
think setuptools could actually add site-setuptools.py to existing 
site.py's even instead of the error or overwriting that it does now.  It 
can use the same technique it uses now to upgrade existing site.py's.

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Distutils-SIG mailing list