-
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #460 from feltra/add_pip_bootstrap
move pip bootstrap into a seperate class
- Loading branch information
Showing
3 changed files
with
58 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# @summary allow to bootstrap pip when python is managed from other module | ||
# | ||
# @param version should be pip or pip3 | ||
# @param manage_python if python module will manage deps | ||
# | ||
# @example | ||
# class { 'python::pip::bootstrap': | ||
# version => 'pip', | ||
# } | ||
class python::pip::bootstrap ( | ||
Enum['pip', 'pip3'] $version = 'pip', | ||
Variant[Boolean, String] $manage_python = false, | ||
) inherits ::python::params { | ||
if $manage_python { | ||
include ::python | ||
} else { | ||
$target_src_pip_path = $facts['os']['family'] ? { | ||
'AIX' => '/opt/freeware/bin', | ||
default => '/usr/bin' | ||
} | ||
if $version == 'pip3' { | ||
exec { 'bootstrap pip3': | ||
command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python3', | ||
unless => 'which pip3', | ||
path => $python::params::pip_lookup_path, | ||
require => Package['python3'], | ||
} | ||
# puppet is opinionated about the pip command name | ||
file { 'pip3-python': | ||
ensure => link, | ||
path => '/usr/bin/pip3', | ||
target => "${target_src_pip_path}/pip${::facts['python3_release']}", | ||
require => Exec['bootstrap pip3'], | ||
} | ||
} else { | ||
exec { 'bootstrap pip': | ||
command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python', | ||
unless => 'which pip', | ||
path => $python::params::pip_lookup_path, | ||
require => Package['python'], | ||
} | ||
# puppet is opinionated about the pip command name | ||
file { 'pip-python': | ||
ensure => link, | ||
path => '/usr/bin/pip', | ||
target => "${target_src_pip_path}/pip${::facts['python2_release']}", | ||
require => Exec['bootstrap pip'], | ||
} | ||
} | ||
} | ||
} |