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(-) (limited to 'manifests') 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