From 4af8ebbad751320330d86c42fc65cfc1e4a2168c Mon Sep 17 00:00:00 2001 From: msrai Date: Mon, 30 Jan 2017 17:27:41 +0100 Subject: [PATCH] fix install distribute/setuptools on virtualenv --- manifests/virtualenv.pp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 459b3399..34a175e2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -159,7 +159,7 @@ $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" exec { "python_virtualenv_${venv_dir}": - command => "true ${proxy_command} && ${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} wheel --help > /dev/null 2>&1 && { ${pip_cmd} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", + command => "true ${proxy_command} && ${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} wheel --help > /dev/null 2>&1 && { ${pip_cmd} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip || ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ;}", user => $owner, creates => "${venv_dir}/bin/activate", path => $path, @@ -169,6 +169,17 @@ require => File[$venv_dir], } + + exec { "python_distribute_${venv_dir}": + command => "${pip_cmd} wheel --help > /dev/null 2>&1 && { ${pip_cmd} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade ${distribute_pkg} || ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} ;}", + user => $owner, + cwd => $cwd, + environment => $environment, + path => $path, + 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 + require => Exec["python_virtualenv_${venv_dir}"], + } + if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": command => "${pip_cmd} wheel --help > /dev/null 2>&1 && { ${pip_cmd} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements} ${extra_pip_args}", @@ -187,7 +198,7 @@ owner => $owner, group => $group, cwd => $cwd, - require => Exec["python_virtualenv_${venv_dir}"], + require => Exec["python_distribute_${venv_dir}"], extra_pip_args => $extra_pip_args, } }