diff options
author | Nick Groenen <zoni@zoni.nl> | 2013-03-11 14:28:38 +0100 |
---|---|---|
committer | Nick Groenen <zoni@zoni.nl> | 2013-03-11 14:47:30 +0100 |
commit | 191376c9c29a7b069ba618a3b59ecad129d4e320 (patch) | |
tree | 0d15868076778b72969dac8b9eb56c1767667545 | |
parent | 8fb868d5aa7bbe4d19f83367ba86d4ac4deb6d25 (diff) |
Make pip install distribute in a virtualenv optional
pip install distribute currentlyfails on Python 3, this way people can
skip installing it. It's included by default to remain backward-
compatible
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | manifests/virtualenv.pp | 11 |
2 files changed, 13 insertions, 1 deletions
@@ -66,12 +66,15 @@ Creates Python virtualenv. **systempkgs** — Copy system site-packages into virtualenv. Default: don't +**distribute** — Include distribute in the virtualenv. Default: true + python::virtualenv { '/var/www/project1': ensure => present, version => 'system', requirements => '/var/www/project1/requirements.txt', proxy => 'http://proxy.domain.com:3128', systempkgs => true, + distribute => false, } ### python::gunicorn diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e816468..c2595e2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -19,6 +19,9 @@ # [*systempkgs*] # Copy system site-packages into virtualenv. Default: don't # +# [*distribute*] +# Include distribute in the virtualenv. Default: true +# # === Examples # # python::virtualenv { '/var/www/project1': @@ -41,6 +44,7 @@ define python::virtualenv ( $requirements = false, $proxy = false, $systempkgs = false, + $distribute = true, ) { $venv_dir = $name @@ -67,11 +71,16 @@ define python::virtualenv ( default => '--system-site-packages', } + $distribute_pkg = $distribute ? { + true => 'distribute', + default => '', + } + exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} \ ${proxy_command} \ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ - && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade distribute pip", + && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip", creates => $venv_dir, } |