Skip to content

Commit

Permalink
Install pip packages in python::install::pip
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Oct 9, 2024
1 parent 3dbd902 commit 0a0da14
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
5 changes: 5 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

* [`python`](#python): Installs and manages python, python-dev and gunicorn.
* [`python::install::dev`](#python--install--dev): Installs python development packages
* [`python::install::pip`](#python--install--pip): Installs python pip packages
* [`python::install::venv`](#python--install--venv): Installs python virtualenv packages
* [`python::pip::bootstrap`](#python--pip--bootstrap): allow to bootstrap pip when python is managed from other module

Expand Down Expand Up @@ -295,6 +296,10 @@ Default value: `'/opt/python'`

Installs python development packages

### <a name="python--install--pip"></a>`python::install::pip`

Installs python pip packages

### <a name="python--install--venv"></a>`python::install::venv`

Installs python virtualenv packages
Expand Down
16 changes: 3 additions & 13 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
case $python::provider {
'pip': {
if $python::manage_pip_package {
package { 'pip':
ensure => $python::pip,
require => Package['python'],
}
contain python::install::pip
}

if $python::manage_dev_package and $pythondev {
Expand Down Expand Up @@ -159,11 +156,7 @@
}
} else {
if $python::manage_pip_package {
package { 'python-pip':
ensure => $python::pip,
require => Package['python'],
provider => 'yum',
}
contain python::install::pip
}
}

Expand All @@ -173,10 +166,7 @@
}
default: {
if $python::manage_pip_package {
package { 'pip':
ensure => $python::pip,
require => Package['python'],
}
contain python::install::pip
}

if $python::manage_dev_package and $pythondev {
Expand Down
38 changes: 38 additions & 0 deletions manifests/install/pip.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# @summary Installs python pip packages
class python::install::pip {
include python

case $python::provider {
'pip': {
package { 'pip':
ensure => $python::pip,
require => Package['python'],
}
}
'scl': {
}
'rhscl': {
}
'anaconda': {
}
default: {
case $facts['os']['family'] {
'AIX': {
unless String($python::version) =~ /^python3/ {
package { 'python-pip':
ensure => $python::pip,
require => Package['python'],
provider => 'yum',
}
}
}
default: {
package { 'pip':
ensure => $python::pip,
require => Package['python'],
}
}
}
}
}
}

0 comments on commit 0a0da14

Please sign in to comment.