Paul Belanger 35a83454f2
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>
2017-05-31 14:39:00 -04:00

48 lines
1.3 KiB
Puppet

# Class: pip
#
class pip (
$index_url = 'https://pypi.python.org/simple',
$manage_pip_conf = false,
$optional_settings = {},
$trusted_hosts = [],
) {
include ::pip::params
validate_array($trusted_hosts)
package { $::pip::params::python_devel_package:
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 - -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 {
file { '/etc/pip.conf':
owner => 'root',
group => 'root',
mode => '0444',
content => template('pip/pip.conf.erb'),
replace => true,
}
}
}