comparison modules/python/manifests/install.pp @ 478:adf6fe9bbc17

Update Puppet modules to latest versions
author IBBoard <dev@ibboard.co.uk>
date Thu, 29 Aug 2024 18:47:29 +0100
parents 66c075c5f54a
children
comparison
equal deleted inserted replaced
477:21f6add30502 478:adf6fe9bbc17
13 /\Arh-python[0-9]{2}/ => $python::version, 13 /\Arh-python[0-9]{2}/ => $python::version,
14 default => "python${python::version}", 14 default => "python${python::version}",
15 } 15 }
16 16
17 $pythondev = $facts['os']['family'] ? { 17 $pythondev = $facts['os']['family'] ? {
18 'AIX' => "${python}-devel", 18 'AIX' => "${python}-devel",
19 'Debian' => "${python}-dev", 19 'Debian' => "${python}-dev",
20 'FreeBSD' => undef, 20 'FreeBSD' => undef,
21 'Gentoo' => undef, 21 'Gentoo' => undef,
22 'RedHat' => "${python}-devel", 22 'Archlinux' => undef,
23 'Suse' => "${python}-devel", 23 'RedHat' => "${python}-devel",
24 } 24 'Suse' => "${python}-devel",
25
26 $pip_ensure = $python::pip ? {
27 true => 'present',
28 false => 'absent',
29 default => $python::pip,
30 }
31
32 $dev_ensure = $python::dev ? {
33 true => 'present',
34 false => 'absent',
35 default => $python::dev,
36 } 25 }
37 26
38 if $python::manage_python_package { 27 if $python::manage_python_package {
39 package { 'python': 28 package { 'python':
40 ensure => $python::ensure, 29 ensure => $python::ensure,
41 name => $python, 30 name => $python,
42 } 31 }
43 } 32 }
44 33
34 if $python::manage_venv_package {
35 ##
36 ## CentOS has no extra package for venv
37 ##
38 unless $facts['os']['family'] == 'RedHat' {
39 package { 'python-venv':
40 ensure => $python::venv,
41 name => "${python}-venv",
42 require => Package['python'],
43 }
44 }
45 }
46
45 case $python::provider { 47 case $python::provider {
46 'pip': { 48 'pip': {
47 if $python::manage_pip_package { 49 if $python::manage_pip_package {
48 package { 'pip': 50 package { 'pip':
49 ensure => $pip_ensure, 51 ensure => $python::pip,
50 require => Package['python'], 52 require => Package['python'],
51 } 53 }
52 } 54 }
53 55
54 if $pythondev { 56 if $python::manage_dev_package and $pythondev {
55 package { 'python-dev': 57 package { 'python-dev':
56 ensure => $dev_ensure, 58 ensure => $python::dev,
57 name => $pythondev, 59 name => $pythondev,
58 } 60 }
59 } 61 }
60 62
61 # Respect the $pip_ensure setting 63 # Respect the $python::pip setting
62 unless $pip_ensure == 'absent' { 64 unless $python::pip == 'absent' {
63 # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. 65 # Install pip without pip, see https://pip.pypa.io/en/stable/installing/.
64 include python::pip::bootstrap 66 include python::pip::bootstrap
65 67
66 Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> 68 Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |>
67 69
91 before => Package['python'], 93 before => Package['python'],
92 } 94 }
93 95
94 Package['scl-utils'] -> Package["${python}-scldevel"] 96 Package['scl-utils'] -> Package["${python}-scldevel"]
95 97
96 if $pip_ensure != 'absent' { 98 if $python::pip != 'absent' {
97 Package['scl-utils'] -> Exec['python-scl-pip-install'] 99 Package['scl-utils'] -> Exec['python-scl-pip-install']
98 } 100 }
99 } 101 }
100 102
101 package { "${python}-scldevel": 103 package { "${python}-scldevel":
102 ensure => $dev_ensure, 104 ensure => $python::dev,
103 } 105 }
104 106
105 if $pip_ensure != 'absent' { 107 if $python::pip != 'absent' {
106 exec { 'python-scl-pip-install': 108 exec { 'python-scl-pip-install':
107 command => "${python::exec_prefix}easy_install pip", 109 command => "${python::exec_prefix}easy_install pip",
108 path => ['/usr/bin', '/bin'], 110 path => ['/usr/bin', '/bin'],
109 creates => "/opt/rh/${python::version}/root/usr/bin/pip", 111 creates => "/opt/rh/${python::version}/root/usr/bin/pip",
110 } 112 }
124 126
125 Package <| title == 'python' |> { 127 Package <| title == 'python' |> {
126 tag => 'python-scl-package', 128 tag => 'python-scl-package',
127 } 129 }
128 130
129 Package <| title == 'virtualenv' |> {
130 name => "${python}-python-virtualenv",
131 }
132
133 package { "${python}-scldevel": 131 package { "${python}-scldevel":
134 ensure => $dev_ensure, 132 ensure => $python::dev,
135 tag => 'python-scl-package', 133 tag => 'python-scl-package',
136 } 134 }
137 135
138 package { "${python}-python-pip": 136 package { "${python}-python-pip":
139 ensure => $pip_ensure, 137 ensure => $python::pip,
140 tag => 'python-pip-package', 138 tag => 'python-pip-package',
141 } 139 }
142 140
143 if $python::rhscl_use_public_repository { 141 if $python::rhscl_use_public_repository {
144 Package <| tag == 'python-scl-repo' |> 142 Package <| tag == 'python-scl-repo' |>
172 version => 'pip3', 170 version => 'pip3',
173 } 171 }
174 } else { 172 } else {
175 if $python::manage_pip_package { 173 if $python::manage_pip_package {
176 package { 'python-pip': 174 package { 'python-pip':
177 ensure => $pip_ensure, 175 ensure => $python::pip,
178 require => Package['python'], 176 require => Package['python'],
179 provider => 'yum', 177 provider => 'yum',
180 } 178 }
181 } 179 }
182 } 180 }
183 181
184 if $pythondev { 182 if $python::manage_dev_package and $pythondev {
185 package { 'python-dev': 183 package { 'python-dev':
186 ensure => $dev_ensure, 184 ensure => $python::dev,
187 name => $pythondev, 185 name => $pythondev,
188 alias => $pythondev, 186 alias => $pythondev,
189 provider => 'yum', 187 provider => 'yum',
190 } 188 }
191 } 189 }
192 } 190 }
193 default: { 191 default: {
194 if $python::manage_pip_package { 192 if $python::manage_pip_package {
195 package { 'pip': 193 package { 'pip':
196 ensure => $pip_ensure, 194 ensure => $python::pip,
197 require => Package['python'], 195 require => Package['python'],
198 } 196 }
199 } 197 }
200 198
201 if $pythondev { 199 if $python::manage_dev_package and $pythondev {
202 package { 'python-dev': 200 package { 'python-dev':
203 ensure => $dev_ensure, 201 ensure => $python::dev,
204 name => $pythondev, 202 name => $pythondev,
205 alias => $pythondev, 203 alias => $pythondev,
206 } 204 }
207 } 205 }
208 } 206 }
209 } 207 }
210 208
211 if $facts['os']['family'] == 'RedHat' { 209 if $facts['os']['family'] == 'RedHat' {
212 if $pip_ensure != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) { 210 if $python::pip != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) {
213 require epel 211 require epel
214 } 212 }
215 } 213 }
216 214
217 if String($python::version) =~ /^python3/ { 215 if String($python::version) =~ /^python3/ {
218 $pip_category = undef
219 $pip_package = "${python}-pip" 216 $pip_package = "${python}-pip"
220 $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') 217 $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'')
221 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) { 218 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) {
222 $pip_category = undef
223 $pip_package = 'python3-pip' 219 $pip_package = 'python3-pip'
224 $pip_provider = pip3 220 $pip_provider = pip3
225 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) { 221 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) {
226 $pip_category = undef
227 $pip_package = 'python2-pip' 222 $pip_package = 'python2-pip'
228 $pip_provider = pip2 223 $pip_provider = pip2
229 } elsif $facts['os']['family'] == 'FreeBSD' { 224 } elsif $facts['os']['family'] == 'FreeBSD' {
230 $pip_category = undef
231 $pip_package = "py${python::version}-pip" 225 $pip_package = "py${python::version}-pip"
232 $pip_provider = 'pip' 226 $pip_provider = 'pip'
233 } elsif $facts['os']['family'] == 'Gentoo' { 227 } elsif $facts['os']['family'] == 'Gentoo' {
234 $pip_category = 'dev-python' 228 $pip_package = 'dev-python/pip'
235 $pip_package = 'pip'
236 $pip_provider = 'pip' 229 $pip_provider = 'pip'
237 } elsif ($facts['os']['name'] == 'Ubuntu') and (versioncmp($facts['os']['release']['major'], '20.04') >= 0) { 230 } elsif ($facts['os']['name'] == 'Ubuntu') and (versioncmp($facts['os']['release']['major'], '20.04') >= 0) {
238 $pip_category = undef
239 $pip_package = 'python3-pip' 231 $pip_package = 'python3-pip'
240 $pip_provider = 'pip3' 232 $pip_provider = 'pip3'
241 } elsif ($facts['os']['name'] == 'Debian') and (versioncmp($facts['os']['release']['major'], '11') >= 0) { 233 } elsif ($facts['os']['name'] == 'Debian') and (versioncmp($facts['os']['release']['major'], '11') >= 0) {
242 $pip_category = undef
243 $pip_package = 'python3-pip' 234 $pip_package = 'python3-pip'
244 $pip_provider = 'pip3' 235 $pip_provider = 'pip3'
245 } else { 236 } else {
246 $pip_category = undef
247 $pip_package = 'python-pip' 237 $pip_package = 'python-pip'
248 $pip_provider = 'pip' 238 $pip_provider = 'pip'
249 } 239 }
250 240
251 Package <| title == 'pip' |> { 241 Package <| title == 'pip' |> {
252 name => $pip_package, 242 name => $pip_package,
253 category => $pip_category,
254 } 243 }
255 } 244 }
256 } 245 }
257 246
258 if $python::manage_gunicorn { 247 if $python::manage_gunicorn {