diff --git a/REFERENCE.md b/REFERENCE.md index f3a382e5..fbfb0a48 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -82,6 +82,7 @@ The following parameters are available in the `python` class: * [`manage_dev_package`](#-python--manage_dev_package) * [`manage_venv_package`](#-python--manage_venv_package) * [`manage_pip_package`](#-python--manage_pip_package) +* [`manage_setuptools`](#-python--manage_setuptools) * [`venv`](#-python--venv) * [`gunicorn_package_name`](#-python--gunicorn_package_name) * [`python_pips`](#-python--python_pips) @@ -217,6 +218,14 @@ manage the state for package pip Default value: `$python::params::manage_pip_package` +##### `manage_setuptools` + +Data type: `Boolean` + +if true, install python-setuptools + +Default value: `$facts['os']['family'] ? { 'Archlinux' => true, default => false` + ##### `venv` Data type: `Python::Package::Ensure` diff --git a/manifests/init.pp b/manifests/init.pp index b457edbd..24bf08e4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -22,6 +22,7 @@ # @param manage_dev_package manage the state of the python development package # @param manage_venv_package manage the state for package venv # @param manage_pip_package manage the state for package pip +# @param manage_setuptools if true, install python-setuptools # # @example install python from system python # class { 'python': @@ -61,6 +62,7 @@ Stdlib::Absolutepath $anaconda_install_path = '/opt/python', Boolean $manage_scl = true, Optional[Python::Umask] $umask = undef, + Boolean $manage_setuptools = $facts['os']['family'] ? { 'Archlinux' => true, default => false, }, ) inherits python::params { $exec_prefix = $provider ? { 'scl' => "/usr/bin/scl enable ${version} -- ", diff --git a/manifests/install.pp b/manifests/install.pp index c3db3d80..28885d3a 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -24,6 +24,12 @@ 'Suse' => "${python}-devel", } + if $python::manage_setuptools { + package { 'python-distutils-extra': + ensure => 'installed', + } + } + if $python::manage_python_package { package { 'python': ensure => $python::ensure, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 54c47fc7..bb787a58 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -19,8 +19,10 @@ if facts[:os]['family'] == 'Archlinux' it { is_expected.not_to contain_package('pip') } + it { is_expected.to contain_package('python-setuptools') } else it { is_expected.to contain_package('pip') } + it { is_expected.not_to contain_package('python-setuptools') } end if %w[Archlinux RedHat].include?(facts[:os]['family'])