summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/facter/virtualenv_version.rb7
-rw-r--r--manifests/virtualenv.pp11
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb
new file mode 100644
index 0000000..2ede3f9
--- /dev/null
+++ b/lib/facter/virtualenv_version.rb
@@ -0,0 +1,7 @@
+require 'puppet'
+pkg = Puppet::Type.type(:package).new(:name => "virtualenv")
+Facter.add("virtualenv_version") do
+ setcode do
+ /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1]
+ end
+end
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp
index bdcfc6f..fc46c72 100644
--- a/manifests/virtualenv.pp
+++ b/manifests/virtualenv.pp
@@ -15,6 +15,8 @@
#
# [*systempkgs*]
# Copy system site-packages into virtualenv. Default: don't
+# If virtualenv version < 1.7 this flag has no effect since
+# the system packages were not supported
#
# [*distribute*]
# Include distribute in the virtualenv. Default: true
@@ -88,9 +90,12 @@ define python::virtualenv (
default => "&& export http_proxy=${proxy}",
}
- $system_pkgs_flag = $systempkgs ? {
- false => '',
- default => '--system-site-packages',
+ # Virtualenv versions prior to 1.7 do not support the
+ # --system-site-packages flag, default off for prior versions
+ if versioncmp($::virtualenv_version,'1.7') > 0 and systempkgs == true {
+ $system_pkgs_flag = '--system-site-packages',
+ } else {
+ $system_pkgs_flag = ''
}
$distribute_pkg = $distribute ? {