Skip to content

Commit 2f16648

Browse files
authored
Merge pull request #418 from Feandil/master
Pip: freeze all to be able to control setuptools, distribute, wheel, pip
2 parents b77554c + 3c3ba03 commit 2f16648

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

manifests/pip.pp

+5-5
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
if $ensure != present and $ensure != latest {
216216
exec { "pip_install_${name}":
217217
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}",
218-
unless => "${pip_env} freeze | grep -i -e ${grep_regex}",
218+
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
219219
user => $owner,
220220
group => $group,
221221
umask => $umask,
@@ -227,7 +227,7 @@
227227
} else {
228228
exec { "pip_install_${name}":
229229
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}",
230-
unless => "${pip_env} freeze | grep -i -e ${grep_regex}",
230+
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
231231
user => $owner,
232232
group => $group,
233233
umask => $umask,
@@ -244,7 +244,7 @@
244244
# Explicit version.
245245
exec { "pip_install_${name}":
246246
command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}",
247-
unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
247+
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
248248
user => $owner,
249249
group => $group,
250250
umask => $umask,
@@ -259,7 +259,7 @@
259259
# Whatever version is available.
260260
exec { "pip_install_${name}":
261261
command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}",
262-
unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
262+
unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}",
263263
user => $owner,
264264
group => $group,
265265
umask => $umask,
@@ -289,7 +289,7 @@
289289
# Anti-action, uninstall.
290290
exec { "pip_uninstall_${name}":
291291
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}",
292-
onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}",
292+
onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}",
293293
user => $owner,
294294
group => $group,
295295
umask => $umask,

spec/acceptance/virtualenv_spec.rb

+26
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,32 @@ class { 'python' :
2525
}
2626
EOS
2727

28+
# Run it twice and test for idempotency
29+
apply_manifest(pp, catch_failures: true)
30+
apply_manifest(pp, catch_changes: true)
31+
end
32+
it 'maintains pip version' do
33+
pp = <<-EOS
34+
class { 'python' :
35+
version => 'system',
36+
pip => 'present',
37+
virtualenv => 'present',
38+
}
39+
->
40+
python::virtualenv { 'venv' :
41+
ensure => 'present',
42+
systempkgs => false,
43+
venv_dir => '/opt/venv2',
44+
owner => 'root',
45+
group => 'root',
46+
}
47+
->
48+
python::pip { 'pip' :
49+
ensure => '18.0',
50+
virtualenv => '/opt/venv2',
51+
}
52+
EOS
53+
2854
# Run it twice and test for idempotency
2955
apply_manifest(pp, catch_failures: true)
3056
apply_manifest(pp, catch_changes: true)

0 commit comments

Comments
 (0)