Add pip3 support

We are wanting to start running python3 applications in production, as
a results we need to ensure that pip3 is created.

Because get-pip.py will override existing pip executables, it will be
possible for an existing server to have is version change to python3.
As a result, symlink specifically to pip2 to ensure we have defaulted
properly to python3.

Drop Babel from acceptance testing, this appears to be a failure that
needs to be looked at in the future.

Change-Id: I8f78dfc62cd3745e900eec573e80236137ac5c78
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-05-31 12:26:16 -04:00
parent 4b3f7168ae
commit 35a83454f2
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
3 changed files with 25 additions and 3 deletions

View File

@ -13,9 +13,26 @@ class pip (
ensure => present,
}
if $::operatingsystem != 'CentOS' {
exec { 'download-pip3':
command => "/usr/bin/curl ${::pip::params::get_pip_location} | /usr/bin/python3 - -U --force-reinstall",
creates => $::pip::params::get_pip3_path,
before => Exec['download-pip'],
notify => Exec[$::pip::params::get_pip_path]
}
}
exec { 'download-pip':
command => "/usr/bin/curl ${::pip::params::get_pip_location} | /usr/bin/python",
creates => $::pip::params::get_pip_path,
command => "/usr/bin/curl ${::pip::params::get_pip_location} | /usr/bin/python - -U --force-reinstall",
creates => $::pip::params::get_pip2_path,
notify => Exec[$::pip::params::get_pip_path]
}
# NOTE(pabelanger): Default to pip2 for backwards compat
exec { $::pip::params::get_pip_path:
command => "ln -sf ${::pip::params::get_pip_path} ${::pip::params::get_pip2_path}",
path => '/usr/bin:/bin/',
refreshonly => true,
}
if $manage_pip_conf {

View File

@ -11,18 +11,24 @@ class pip::params {
$python3_devel_package = 'python3-devel'
$python3_pip_package = 'python3-pip'
$get_pip_path = '/bin/pip'
$get_pip2_path = '/bin/pip2'
$get_pip3_path = '/bin/pip3'
}
'Suse': {
$python_devel_package = 'python-devel'
$python3_devel_package = 'python3-devel'
$python3_pip_package = 'python3-pip'
$get_pip_path = '/usr/bin/pip'
$get_pip2_path = '/usr/bin/pip2'
$get_pip3_path = '/usr/bin/pip3'
}
'Debian': {
$python_devel_package = 'python-all-dev'
$python3_devel_package = 'python3-all-dev'
$python3_pip_package = 'python3-pip'
$get_pip_path = '/usr/local/bin/pip'
$get_pip2_path = '/usr/local/bin/pip2'
$get_pip3_path = '/usr/local/bin/pip3'
}
default: {
fail("Unsupported osfamily: ${::osfamily} The 'pip' module only supports osfamily Debian, RedHat or SUSE.")

View File

@ -1,7 +1,6 @@
include pip
$packages = [
'Babel',
'bandersnatch',
'elasticsearch-curator',
'gear',