diff options
author | Sergey Stankevich <stankevich@users.noreply.github.com> | 2014-01-03 23:16:55 -0800 |
---|---|---|
committer | Sergey Stankevich <stankevich@users.noreply.github.com> | 2014-01-03 23:16:55 -0800 |
commit | 45c01b6b018b7fd01119ea592c22cb17be8d4a8d (patch) | |
tree | 941f683c78fc104022970538ad72fe046d932944 /manifests/virtualenv.pp | |
parent | 2bab9c9a03cd01450877d897399c68f37fea0ff7 (diff) | |
parent | b5f48bc7cc5861dee404d43eed5a6d327d22c54e (diff) |
Merge pull request #49 from jalli/master
Add compatability/support for pip 1.5 and fix erroneous rebuilds
Diffstat (limited to 'manifests/virtualenv.pp')
-rw-r--r-- | manifests/virtualenv.pp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 85fc67a..7f7fbb4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -119,18 +119,25 @@ 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} --upgrade pip ${distribute_pkg}", + 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=[\'\"]*/tmp[\"\']*[ \t]*$' /tmp/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} -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, |