Skip to content

Commit 7d916cc

Browse files
AlejandroSupplySideDevelopers
authored andcommitted
First upgrade pip and then install setuptools
1 parent 85887e5 commit 7d916cc

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

manifests/virtualenv.pp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
$pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip"
160160

161161
exec { "python_virtualenv_${venv_dir}":
162-
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} ;}",
162+
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 ;}",
163163
user => $owner,
164164
creates => "${venv_dir}/bin/activate",
165165
path => $path,
@@ -169,13 +169,23 @@
169169
require => File[$venv_dir],
170170
}
171171

172+
exec { "python_distribute_${venv_dir}":
173+
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} ;}",
174+
user => $owner,
175+
cwd => $cwd,
176+
environment => $environment,
177+
path => $path,
178+
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
179+
require => Exec["python_virtualenv_${venv_dir}"],
180+
}
181+
172182
if $requirements {
173183
exec { "python_requirements_initial_install_${requirements}_${venv_dir}":
174184
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}",
175185
refreshonly => true,
176186
timeout => $timeout,
177187
user => $owner,
178-
subscribe => Exec["python_virtualenv_${venv_dir}"],
188+
subscribe => Exec["python_distribute_${venv_dir}"],
179189
environment => $environment,
180190
cwd => $cwd
181191
}

0 commit comments

Comments
 (0)