diff options
author | Sergey Stankevich <sergey@stankevi.ch> | 2013-03-14 04:44:10 -0700 |
---|---|---|
committer | Sergey Stankevich <sergey@stankevi.ch> | 2013-03-14 04:44:10 -0700 |
commit | 7abfab94312888cdbafd67a955677048e081a2c3 (patch) | |
tree | e0480625a589dc537f9f7f9952b49dd26ee80321 | |
parent | 34f562aa3ea82462022e9d3ab625ab63b3237fa4 (diff) | |
parent | 191376c9c29a7b069ba618a3b59ecad129d4e320 (diff) |
Merge pull request #5 from zoni/distribute
Make pip install distribute in a virtualenv optional
-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 b56da85..ace2a00 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, } |