Hi there,

A long-standing issue with using buildout is that even though it creates a restricted environment, it still uses the site-packages of the system python and there's no way to get rid of it. This is why for instance the Grok project tells people to create their buildouts within a "virtualenv --no-site-packages" virtual env. Because if we don't, a lot of people (especially all Mac OS X users that don't create their own python) will have a failing buildout due to conflicting libraries.

The following code snippet could be added to the buildout-generated scripts, after the 'sys.path[:]' assignment:

import site
packages = set(sys.path)
site_packages = set()
site.addsitepackages(site_packages)
packages = packages.difference(site_packages)
sys.path = list(packages)

This cleans all site packages out of sys.path before any further code is executed.

How to make sure we run without site packages? We could of course add an option to buildout when it's run:

$ bin/buildout --no-site-packages

Unfortunately this would mean all buildout users would need to remember this. It therefore seems sensible to me to also add one to buildout.cfg:

[buildout]
no-site-packages = true

What do people think?

See also this bug:

https://bugs.launchpad.net/zc.buildout/+bug/429383

Regards,

Martijn

_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to