Skip to content

Commit af932f0

Browse files
committed
Do not try to reinstall packages installed via the OS
Pip freeze provides another list than pip list, see also online questions like: http://stackoverflow.com/questions/19837410/why-doesnt-setuptools-1-3-1-appear-when-i-pip-freeze To prevent continuous reinstalls of things like setuptools, examine pip list output as well.
1 parent bc5eb8c commit af932f0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

manifests/pip.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
# Explicit version.
220220
exec { "pip_install_${name}":
221221
command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}",
222-
unless => "${pip_env} freeze | grep -i -e ${grep_regex}",
222+
unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
223223
user => $owner,
224224
group => $group,
225225
cwd => $cwd,
@@ -228,12 +228,12 @@
228228
path => $path,
229229
}
230230
}
231-
231+
#
232232
present: {
233233
# Whatever version is available.
234234
exec { "pip_install_${name}":
235235
command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}",
236-
unless => "${pip_env} freeze | grep -i -e ${grep_regex}",
236+
unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
237237
user => $owner,
238238
group => $group,
239239
cwd => $cwd,

0 commit comments

Comments
 (0)