From 0b4438b64eb2f24f9aff75116cbefb3fc85b5241 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Wed, 1 Jan 2014 12:44:24 -0500 Subject: Fix path for unless statement. https://github.com/stankevich/puppet-python/issues/46 --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bc7141c..f74cc4f 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -125,7 +125,7 @@ define python::virtualenv ( path => $path, cwd => "/tmp", environment => $environment, - unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*/tmp[\"\']*[ \t]*$' /tmp/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*/tmp[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { -- cgit v1.2.3 From ae04aad7b8fd5f88f6bc379dbabd21000dcb9a85 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 11:36:39 -0500 Subject: Add flag to disable wheels for python 2.6 Setuptools 0.8 is required for pip wheel support, Python 2.6 and older only support setuptools 0.7, we therefor need to disable wheels. --- manifests/virtualenv.pp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index f74cc4f..3a7997e 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -98,7 +98,7 @@ define python::virtualenv ( default => "&& export http_proxy=${proxy}", } - # Virtualenv versions prior to 1.7 do not support the + # Virtualenv versions prior to 1.7 do not support the # --system-site-packages flag, default off for prior versions # Prior to version 1.7 the default was equal to --system-site-packages # and the flag --no-site-packages had to be passed to do the opposite @@ -110,6 +110,14 @@ define python::virtualenv ( $system_pkgs_flag = '' } + # Python 2.6 and older don't support setuptools > 0.8 which is required + # for pip wheel support, it therefor requires --no-use-wheel flag + if ( versioncmp($::python_version,'2.6') > 0 ) { + $wheel_support_flag = '--no-use-wheel' + } else { + $wheel_support_flag = '' + } + $distribute_pkg = $distribute ? { true => 'distribute', default => '', @@ -120,7 +128,7 @@ define python::virtualenv ( } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} ${wheel_support_flag} --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", @@ -130,7 +138,7 @@ define python::virtualenv ( if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}", + command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} ${wheel_support_flag} -r ${requirements}", refreshonly => true, timeout => $timeout, user => $owner, -- cgit v1.2.3 From 5dfe3e57489790823928a90363d7ab81500ce5e8 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 12:45:56 -0500 Subject: Fix wheel flag for pip commands Python 2.6 does not support setuptools < 0.8 which is required for pip wheel support, older versions need to use the --no-use-wheel flag --- manifests/pip.pp | 16 ++++++++++++---- manifests/virtualenv.pp | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index bcb7911..ba83658 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -70,6 +70,14 @@ define python::pip ( default => "--proxy=${proxy}", } + # Python 2.6 and older don't support setuptools > 0.8 which is required + # for pip wheel support, pip therefor requires --no-use-wheel flag + if ( versioncmp($::python_version,'2.6') > 0 ) { + $wheel_support_flag = '--no-use-wheel' + } else { + $wheel_support_flag = '' + } + $grep_regex = $name ? { /==/ => "^${name}\$", default => "^${name}==", @@ -88,7 +96,7 @@ define python::pip ( case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install $install_args ${proxy_flag} ${source}", + command => "$pip_env --log ${cwd}/pip.log install $install_args ${wheel_support_flag} ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -98,7 +106,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install --upgrade ${proxy_flag} ${source}", + command => "$pip_env --log ${cwd}/pip.log install --upgrade ${wheel_support_flag} ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -107,7 +115,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${proxy_flag} ${source}", + command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${wheel_support_flag} ${proxy_flag} ${source}", user => $owner, environment => $environment, } @@ -115,7 +123,7 @@ define python::pip ( default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", + command => "echo y | $pip_env uninstall $uninstall_args ${wheel_support_flag} ${proxy_flag} ${name}", onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 3a7997e..7b4b53c 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -111,7 +111,7 @@ define python::virtualenv ( } # Python 2.6 and older don't support setuptools > 0.8 which is required - # for pip wheel support, it therefor requires --no-use-wheel flag + # for pip wheel support, pip therefor requires --no-use-wheel flag if ( versioncmp($::python_version,'2.6') > 0 ) { $wheel_support_flag = '--no-use-wheel' } else { -- cgit v1.2.3 From 6d88eb88f3ec00655a25f9cb83efd58f293ef4fe Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:25:27 -0500 Subject: Fix wheel support and pip version compatability Fix wheel support and compatability for older pip versions by detecting suppport when running the pip command inside a virtualenv. --- lib/facter/pip_version.rb | 2 +- manifests/pip.pp | 20 ++++++++++---------- manifests/virtualenv.pp | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 48dd0bf..131d1f9 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -5,7 +5,7 @@ pkg = Puppet::Type.type(:package).new(:name => "python-pip") Facter.add("pip_version") do has_weight 100 setcode do - Facter::Util::Resolution.exec('pip --version') + /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version'))[1] end end diff --git a/manifests/pip.pp b/manifests/pip.pp index ba83658..a818e23 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -70,13 +70,6 @@ define python::pip ( default => "--proxy=${proxy}", } - # Python 2.6 and older don't support setuptools > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag - if ( versioncmp($::python_version,'2.6') > 0 ) { - $wheel_support_flag = '--no-use-wheel' - } else { - $wheel_support_flag = '' - } $grep_regex = $name ? { /==/ => "^${name}\$", @@ -93,10 +86,17 @@ define python::pip ( default => "${url}#egg=${egg_name}", } + # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required + # for pip wheel support, pip therefor requires --no-use-wheel flag if the + # pip version is more recent thatn 1.4.1 but using an old python or + # setuputils/distribute version + # To check for this we test for wheel parameter using help and then using + # version, this makes sure we only use wheels if they are supported + case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install $install_args ${wheel_support_flag} ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install --upgrade ${wheel_support_flag} ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${wheel_support_flag} ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7b4b53c..7b39212 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -110,9 +110,10 @@ define python::virtualenv ( $system_pkgs_flag = '' } - # Python 2.6 and older don't support setuptools > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag - if ( versioncmp($::python_version,'2.6') > 0 ) { + # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required + # for pip wheel support, pip therefor requires --no-use-wheel flag if the + # version is newer than 1.4.1 when they added wheels + if (( versioncmp($::python_version,'2.6') > 0 and ( versioncmp($::pip_version,'1.4.1') > 0)) { $wheel_support_flag = '--no-use-wheel' } else { $wheel_support_flag = '' -- cgit v1.2.3 From a49582f22a71baf746ff06c10850a207a99a9750 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:32:51 -0500 Subject: Fix quoting of exec commands to use single quotes --- manifests/pip.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a818e23..6c0425e 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -96,7 +96,7 @@ define python::pip ( case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } -- cgit v1.2.3 From 784a8bca85023490169bf9663740419caea776a0 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:44:44 -0500 Subject: Fix syntax error in conditional statement --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7b39212..3e61e1f 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -113,7 +113,7 @@ define python::virtualenv ( # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required # for pip wheel support, pip therefor requires --no-use-wheel flag if the # version is newer than 1.4.1 when they added wheels - if (( versioncmp($::python_version,'2.6') > 0 and ( versioncmp($::pip_version,'1.4.1') > 0)) { + if (( versioncmp($::python_version,'2.6') > 0 ) and ( versioncmp($::pip_version,'1.4.1') > 0)) { $wheel_support_flag = '--no-use-wheel' } else { $wheel_support_flag = '' -- cgit v1.2.3 From 10633ecbde7bd269e0e02d1ae5ba5313bc00c24b Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:56:38 -0500 Subject: Fix handling of wheel support for initial pip --- manifests/pip.pp | 6 +++--- manifests/virtualenv.pp | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 6c0425e..5849ca9 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -86,9 +86,9 @@ define python::pip ( default => "${url}#egg=${egg_name}", } - # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag if the - # pip version is more recent thatn 1.4.1 but using an old python or + # Python 2.6 and older does not support setuptools/distribute > 0.8 which + # is required for pip wheel support, pip therefor requires --no-use-wheel flag + # if the # pip version is more recent than 1.4.1 but using an old python or # setuputils/distribute version # To check for this we test for wheel parameter using help and then using # version, this makes sure we only use wheels if they are supported diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 3e61e1f..94bbd15 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -110,15 +110,6 @@ define python::virtualenv ( $system_pkgs_flag = '' } - # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag if the - # version is newer than 1.4.1 when they added wheels - if (( versioncmp($::python_version,'2.6') > 0 ) and ( versioncmp($::pip_version,'1.4.1') > 0)) { - $wheel_support_flag = '--no-use-wheel' - } else { - $wheel_support_flag = '' - } - $distribute_pkg = $distribute ? { true => 'distribute', default => '', @@ -128,8 +119,15 @@ define python::virtualenv ( default => "-i ${index}", } + # Python 2.6 and older does not support setuptools/distribute > 0.8 which + # is required for pip wheel support, pip therefor requires --no-use-wheel flag + # if the # pip version is more recent than 1.4.1 but using an old python or + # setuputils/distribute version + # To check for this we test for wheel parameter using help and then using + # version, this makes sure we only use wheels if they are supported + exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} ${wheel_support_flag} --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && ${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", -- cgit v1.2.3 From 44acbef424819e226bec875aabf3db44a06b7015 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 16:01:36 -0500 Subject: Fix simple typo --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 5849ca9..5e287f7 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -106,7 +106,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], -- cgit v1.2.3 From f2266d7070a3c6f1a07b7746448c647e3bc37b88 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 16:14:57 -0500 Subject: Fix bash logic false positives --- manifests/pip.pp | 6 +++--- manifests/virtualenv.pp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 5e287f7..5c218c5 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -96,7 +96,7 @@ define python::pip ( case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 94bbd15..9c9502d 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,7 +127,7 @@ define python::virtualenv ( # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && ${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && (${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'); ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", -- cgit v1.2.3 From 1087abd3ba21bcb5b33f7c40f07724c1b9a093eb Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 09:34:04 -0500 Subject: Further fixes for pip 1.5 and wheel handling --- manifests/pip.pp | 6 +++--- manifests/virtualenv.pp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 5c218c5..e9ab7cd 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -96,7 +96,7 @@ define python::pip ( case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help > /dev/null 2>&1 && { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help > /dev/null 2>&1&& { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ define python::pip ( latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help > /dev/null 2>&1&& { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 9c9502d..7a548a6 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,7 +127,7 @@ define python::virtualenv ( # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && (${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'); ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", -- cgit v1.2.3 From d8a72b218455de66b59af0229ebae2e708538e77 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 10:09:56 -0500 Subject: Fix testing for existing virtual environment --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7a548a6..f3ca1ce 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -132,7 +132,7 @@ define python::virtualenv ( path => $path, cwd => "/tmp", environment => $environment, - unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*/tmp[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*${venv_dir}[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { -- cgit v1.2.3 From 7ae9495652889b69543c57869d181e4b479070b4 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 10:49:25 -0500 Subject: Fix grep for detecting if virtenv needs rebuild --- manifests/virtualenv.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index f3ca1ce..cee35fc 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -119,7 +119,7 @@ define python::virtualenv ( default => "-i ${index}", } - # Python 2.6 and older does not support setuptools/distribute > 0.8 which + # Python 2.6 and older does not support setuptools/distribute > 0.8 which # is required for pip wheel support, pip therefor requires --no-use-wheel flag # if the # pip version is more recent than 1.4.1 but using an old python or # setuputils/distribute version @@ -132,7 +132,7 @@ define python::virtualenv ( path => $path, cwd => "/tmp", environment => $environment, - unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*${venv_dir}[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { -- cgit v1.2.3 From 895eebf2a03a29959d0c4dbd613cfa345ac22b55 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 10:53:24 -0500 Subject: Cleanup for merge request --- manifests/pip.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index e9ab7cd..f71cdcd 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -70,7 +70,6 @@ define python::pip ( default => "--proxy=${proxy}", } - $grep_regex = $name ? { /==/ => "^${name}\$", default => "^${name}==", @@ -123,7 +122,7 @@ define python::pip ( default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall $uninstall_args ${wheel_support_flag} ${proxy_flag} ${name}", + command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, -- cgit v1.2.3 From 223da1caddb69418fc1a6383dbb5ea65c9fcdf90 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 11:45:39 -0500 Subject: Fix wheel/pip1.5 handing with requirements --- manifests/virtualenv.pp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index a779141..fc540a8 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,17 +127,17 @@ define python::virtualenv ( # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", - user => $owner, - path => $path, - cwd => "/tmp", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + user => $owner, + path => $path, + cwd => "/tmp", environment => $environment, - unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} ${wheel_support_flag} -r ${requirements}", + command => "${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements}", refreshonly => true, timeout => $timeout, user => $owner, -- cgit v1.2.3 From b5f48bc7cc5861dee404d43eed5a6d327d22c54e Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 13:01:45 -0500 Subject: Fix working dir for virtualenv creation --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fc540a8..7f7fbb4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -130,7 +130,7 @@ define python::virtualenv ( command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, - cwd => "/tmp", + cwd => $venv_dir, environment => $environment, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } -- cgit v1.2.3