File tree 6 files changed +46
-18
lines changed
6 files changed +46
-18
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ python::version : ' 39'
Original file line number Diff line number Diff line change 49
49
Boolean $manage_dev_package = true ,
50
50
Boolean $manage_venv_package = $python::params::manage_venv_package ,
51
51
Boolean $manage_pip_package = $python::params::manage_pip_package ,
52
+ Optional[String[1]] $pip_package_name = undef ,
52
53
String[1] $gunicorn_package_name = $python::params::gunicorn_package_name ,
53
54
Optional[Python::Provider] $provider = undef ,
54
55
Hash $python_pips = {},
68
69
default => ' ' ,
69
70
}
70
71
72
+ $pip_package_real_name = $pip_package_name .lest || {
73
+ fact(' os.family' ) ? {
74
+ ' FreeBSD' => " py${version} -pip" ,
75
+ default => ' python-pip' ,
76
+ }
77
+ }
78
+
79
+
71
80
contain python::install
72
81
contain python::config
73
82
Original file line number Diff line number Diff line change 48
48
# Respect the $python::pip setting
49
49
unless $python::pip == ' absent' {
50
50
# Install pip without pip, see https://pip.pypa.io/en/stable/installing/.
51
- include python::pip::bootstrap
51
+ contain python::pip::bootstrap
52
52
53
53
Exec[' bootstrap pip' ] -> File [' pip-python' ] -> Package <| provider == pip |>
54
54
Original file line number Diff line number Diff line change 15
15
}
16
16
' anaconda' : {
17
17
}
18
- default: {
18
+ pip, default: {
19
19
case $facts [' os' ][' family' ] {
20
20
' AIX' : {
21
21
unless String($python::version ) =~ /^python3/ {
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe 'python::install::pip' do
6
+ on_supported_os . each do |os , facts |
7
+ context "on #{ os } " do
8
+ let :facts do
9
+ facts
10
+ end
11
+
12
+ context 'with default settings' do
13
+ it { is_expected . to contain_package ( 'pip' ) . with ( ensure : 'present' ) }
14
+ end
15
+
16
+ context 'when ensuring pip is absent' do
17
+ let ( :pre_condition ) do
18
+ <<~PP
19
+ class { 'python':
20
+ pip => absent,
21
+ }
22
+ PP
23
+ end
24
+
25
+ it { is_expected . to contain_package ( 'pip' ) . with ( ensure : 'absent' ) }
26
+ end
27
+ end
28
+ end
29
+ end
Original file line number Diff line number Diff line change 18
18
it { is_expected . to contain_package ( 'python' ) }
19
19
20
20
if facts [ :os ] [ 'family' ] == 'Archlinux'
21
- it { is_expected . not_to contain_package ( ' pip') }
21
+ it { is_expected . not_to contain_class ( 'python::install:: pip') }
22
22
else
23
- it { is_expected . to contain_package ( ' pip') }
23
+ it { is_expected . to contain_class ( 'python::install:: pip') }
24
24
end
25
25
26
26
if %w[ Archlinux ] . include? ( facts [ :os ] [ 'family' ] )
43
43
it { is_expected . to compile . with_all_deps }
44
44
it { is_expected . not_to contain_package ( 'python' ) }
45
45
it { is_expected . not_to contain_package ( 'python-dev' ) }
46
- it { is_expected . not_to contain_package ( ' pip') }
46
+ it { is_expected . not_to contain_class ( 'python::install:: pip') }
47
47
it { is_expected . not_to contain_class ( 'python::install::venv' ) }
48
48
end
49
49
50
- context 'with packages present' do
51
- let :params do
52
- {
53
- manage_pip_package : true ,
54
- pip : 'present' ,
55
- }
56
- end
57
-
58
- it { is_expected . to compile . with_all_deps }
59
- it { is_expected . to contain_package ( 'pip' ) . with ( ensure : 'present' ) }
60
- end
61
-
62
50
case facts [ :os ] [ 'family' ]
63
51
when 'Debian'
64
52
68
56
# Base debian packages.
69
57
it { is_expected . to contain_package ( 'python' ) }
70
58
it { is_expected . to contain_package ( 'python-dev' ) }
71
- it { is_expected . to contain_package ( ' pip') }
59
+ it { is_expected . to contain_class ( 'python::install:: pip') }
72
60
73
61
describe 'with python::version' do
74
62
context 'python3.7' do
You can’t perform that action at this time.
0 commit comments