Skip to content

Commit 191376c

Browse files
author
Nick Groenen
committed
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
1 parent 8fb868d commit 191376c

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ Creates Python virtualenv.
6666

6767
**systempkgs** — Copy system site-packages into virtualenv. Default: don't
6868

69+
**distribute** — Include distribute in the virtualenv. Default: true
70+
6971
python::virtualenv { '/var/www/project1':
7072
ensure => present,
7173
version => 'system',
7274
requirements => '/var/www/project1/requirements.txt',
7375
proxy => 'http://proxy.domain.com:3128',
7476
systempkgs => true,
77+
distribute => false,
7578
}
7679

7780
### python::gunicorn

manifests/virtualenv.pp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
# [*systempkgs*]
2020
# Copy system site-packages into virtualenv. Default: don't
2121
#
22+
# [*distribute*]
23+
# Include distribute in the virtualenv. Default: true
24+
#
2225
# === Examples
2326
#
2427
# python::virtualenv { '/var/www/project1':
@@ -41,6 +44,7 @@
4144
$requirements = false,
4245
$proxy = false,
4346
$systempkgs = false,
47+
$distribute = true,
4448
) {
4549

4650
$venv_dir = $name
@@ -67,11 +71,16 @@
6771
default => '--system-site-packages',
6872
}
6973

74+
$distribute_pkg = $distribute ? {
75+
true => 'distribute',
76+
default => '',
77+
}
78+
7079
exec { "python_virtualenv_${venv_dir}":
7180
command => "mkdir -p ${venv_dir} \
7281
${proxy_command} \
7382
&& virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \
74-
&& ${venv_dir}/bin/pip install ${proxy_flag} --upgrade distribute pip",
83+
&& ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip",
7584
creates => $venv_dir,
7685
}
7786

0 commit comments

Comments
 (0)