Search code examples
djangobuildout

In buildout, include-site-packages=false is not excluding dist-packages


I am installing a python application on an ubuntu server. I have added include-site-packages=false in buildout.cfg but it is still not ignoring dist-packages.


Solution

  • Buildout doesn't know about anything dist-packages, as that's a Debian and Ubuntu specific addition to Python. If buildout doesn't exclude it when you exclude site-packages, then is not the only package to have this 'problem'; virtualenv doesn't know about it either, see Ubuntu + virtualenv = a mess? virtualenv hates dist-packages, wants site-packages.

    Feel free to file an issue in the buildout issue tracker to request that dist-packages is included when ignoring site-packages.

    Note that on my Debian system however, the dist-packages directory is being excluded.

    Buildout normally determines what the site-packages directories are by determining the difference between the following two commands:

    PYTHONNOUSERSITE="x" python -c "import sys, os;print repr([os.path.normpath(p) for p in sys.path if p])"
    

    and

    python -S -c "import sys, os;print repr([os.path.normpath(p) for p in sys.path if p])"
    

    If the latter still includes the dist-packages directory for you, then I'd classify this as a Ubuntu or Debian bug. On Debian 6.0.5, with zc.buildout 1.5.2 that path is not included.

    The dist-packages directory is normally added via the site.py module (which the -S switch above disables). Debian and Ubuntu have patched that module.