|
6 | 6 | # |
7 | 7 | class python::install { |
8 | 8 |
|
9 | | - $python_version = getparam(Class['python'], 'version') |
10 | | - $python = $python_version ? { |
11 | | - 'system' => 'python', |
12 | | - 'pypy' => 'pypy', |
13 | | - /\A(python)?([0-9](\.?[0-9])+)/ => "python${2}", |
14 | | - /\Arh-python[0-9]{2}/ => $python_version, |
15 | | - default => "python${python::version}", |
| 9 | + $python = $python::version ? { |
| 10 | + 'system' => 'python', |
| 11 | + 'pypy' => 'pypy', |
| 12 | + /\A(python)?([0-9]+)/ => "python${2}", |
| 13 | + /\Arh-python[0-9]{2}/ => $python::version, |
| 14 | + default => "python${python::version}", |
16 | 15 | } |
17 | 16 |
|
18 | 17 | $pythondev = $facts['os']['family'] ? { |
|
57 | 56 |
|
58 | 57 | package { 'virtualenv': |
59 | 58 | ensure => $venv_ensure, |
| 59 | + name => "${python}-virtualenv", |
60 | 60 | require => Package['python'], |
61 | 61 | } |
62 | 62 |
|
|
144 | 144 | } |
145 | 145 | 'rhscl': { |
146 | 146 | # rhscl is RedHat SCLs from softwarecollections.org |
147 | | - if $::python::rhscl_use_public_repository { |
148 | | - $scl_package = "rhscl-${::python::version}-epel-${::operatingsystemmajrelease}-${::architecture}" |
| 147 | + if $python::rhscl_use_public_repository { |
| 148 | + $scl_package = "rhscl-${python::version}-epel-${::operatingsystemmajrelease}-${::architecture}" |
149 | 149 | package { $scl_package: |
150 | | - source => "https://www.softwarecollections.org/en/scls/rhscl/${::python::version}/epel-${::operatingsystemmajrelease}-${::architecture}/download/${scl_package}.noarch.rpm", |
| 150 | + source => "https://www.softwarecollections.org/en/scls/rhscl/${python::version}/epel-${::operatingsystemmajrelease}-${::architecture}/download/${scl_package}.noarch.rpm", |
151 | 151 | provider => 'rpm', |
152 | 152 | tag => 'python-scl-repo', |
153 | 153 | } |
|
171 | 171 | tag => 'python-pip-package', |
172 | 172 | } |
173 | 173 |
|
174 | | - if $::python::rhscl_use_public_repository { |
| 174 | + if $python::rhscl_use_public_repository { |
175 | 175 | Package <| tag == 'python-scl-repo' |> |
176 | 176 | -> Package <| tag == 'python-scl-package' |> |
177 | 177 | } |
|
183 | 183 | $installer_path = '/var/tmp/anaconda_installer.sh' |
184 | 184 |
|
185 | 185 | file { $installer_path: |
186 | | - source => $::python::anaconda_installer_url, |
| 186 | + source => $python::anaconda_installer_url, |
187 | 187 | mode => '0700', |
188 | 188 | } |
189 | 189 | -> exec { 'install_anaconda_python': |
190 | | - command => "${installer_path} -b -p ${::python::anaconda_install_path}", |
191 | | - creates => $::python::anaconda_install_path, |
| 190 | + command => "${installer_path} -b -p ${python::anaconda_install_path}", |
| 191 | + creates => $python::anaconda_install_path, |
192 | 192 | logoutput => true, |
193 | 193 | } |
194 | 194 | -> exec { 'install_anaconda_virtualenv': |
195 | | - command => "${::python::anaconda_install_path}/bin/pip install virtualenv", |
196 | | - creates => "${::python::anaconda_install_path}/bin/virtualenv", |
| 195 | + command => "${python::anaconda_install_path}/bin/pip install virtualenv", |
| 196 | + creates => "${python::anaconda_install_path}/bin/virtualenv", |
197 | 197 | } |
198 | 198 | } |
199 | 199 | default: { |
200 | 200 | case $facts['os']['family'] { |
201 | 201 | 'AIX': { |
202 | | - if "${python_version}" =~ /^python3/ { #lint:ignore:only_variable_string |
203 | | - class { 'python::pip::bootstap': |
| 202 | + if String($python::version) =~ /^python3/ { |
| 203 | + class { 'python::pip::bootstrap': |
204 | 204 | version => 'pip3', |
205 | 205 | } |
206 | 206 | } else { |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 |
|
271 | | - if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string |
| 271 | + if String($python::version) =~ /^python3/ { |
272 | 272 | $pip_category = undef |
273 | | - $pip_package = 'python3-pip' |
| 273 | + $pip_package = "${python}-pip" |
| 274 | + $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') |
274 | 275 | } elsif ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemmajrelease, '7') >= 0) { |
275 | 276 | $pip_category = undef |
276 | 277 | $pip_package = 'python2-pip' |
| 278 | + $pip_provider = pip2 |
277 | 279 | } elsif $::osfamily == 'Gentoo' { |
278 | 280 | $pip_category = 'dev-python' |
279 | 281 | $pip_package = 'pip' |
| 282 | + $pip_provider = 'pip' |
280 | 283 | } else { |
281 | 284 | $pip_category = undef |
282 | 285 | $pip_package = 'python-pip' |
| 286 | + $pip_provider = 'pip' |
283 | 287 | } |
284 | 288 |
|
285 | 289 | Package <| title == 'pip' |> { |
286 | 290 | name => $pip_package, |
287 | 291 | category => $pip_category, |
288 | 292 | } |
289 | 293 |
|
| 294 | + Python::Pip <| |> { |
| 295 | + pip_provider => $pip_provider, |
| 296 | + } |
| 297 | + |
290 | 298 | Package <| title == 'virtualenv' |> { |
291 | 299 | name => $virtualenv_package, |
292 | 300 | } |
|
0 commit comments