Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make sure buildout doesn't use the already installed packages?

I am trying to switch fully to buildout - but our development environment already has lot of stuff installed in /usr/lib/pythonxx/

How can I make sure that buildout doesn't use the libraries installed on the system already - eventually without virtualenv ?

For example - how to avoid this behavior ? :

> cat buildout.cfg
[buildout]
parts = django

[django]
recipe = zc.recipe.egg
eggs = django
interpreter = django

>bin/django 

>>> import django
>>> django
<module 'django' from '/usr/lib/python2.6/site-packages/django/__init__.pyc'>
>>> 

Is there anyway to force buildout NOT to use the eggs installed in /usr/lib/python2.6 ?

like image 312
Martin Avatar asked Jan 29 '11 20:01

Martin


2 Answers

You can tell buildout if you want to use site-pakages or not with one of these two directives: include-site-packages and allowed-eggs-from-site-packages

From buildout documentation:

You can then use include-site-packages = false and exec-sitecustomize = false buildout options to eliminate access to your Python's site packages and not execute its sitecustomize file, if it exists, respectively.

Alternately, you can use the allowed-eggs-from-site-packages buildout option as a glob-aware whitelist of eggs that may come from site-packages. This value defaults to "*", accepting all eggs.

like image 63
Ski Avatar answered Oct 09 '22 08:10

Ski


Two ways:

  • Use the latest 1.5.something buildouts: they don't use the system packages by default.

  • Run the bootstrap command with the -s flag: python bootstrap.py -s, which means "no site packages".

like image 31
Reinout van Rees Avatar answered Oct 09 '22 07:10

Reinout van Rees