Skip to content

Commit 387fa0d

Browse files
committed
Add option to install python-setuptools
This is required at least on Arch Linux because distutils is provided by python-setuptools, not python: https://gitlab.archlinux.org/archlinux/packaging/packages/thefuck/-/issues/1
1 parent 04e4d4c commit 387fa0d

File tree

4 files changed

+19
-0
lines changed

4 files changed

+19
-0
lines changed

REFERENCE.md

+9
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ The following parameters are available in the `python` class:
8282
* [`manage_dev_package`](#-python--manage_dev_package)
8383
* [`manage_venv_package`](#-python--manage_venv_package)
8484
* [`manage_pip_package`](#-python--manage_pip_package)
85+
* [`manage_setuptools`](#-python--manage_setuptools)
8586
* [`venv`](#-python--venv)
8687
* [`gunicorn_package_name`](#-python--gunicorn_package_name)
8788
* [`python_pips`](#-python--python_pips)
@@ -217,6 +218,14 @@ manage the state for package pip
217218

218219
Default value: `$python::params::manage_pip_package`
219220

221+
##### <a name="-python--manage_setuptools"></a>`manage_setuptools`
222+
223+
Data type: `Boolean`
224+
225+
if true, install python-setuptools
226+
227+
Default value: `$facts['os']['family'] ? { 'Archlinux' => true, default => false`
228+
220229
##### <a name="-python--venv"></a>`venv`
221230

222231
Data type: `Python::Package::Ensure`

manifests/init.pp

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# @param manage_dev_package manage the state of the python development package
2323
# @param manage_venv_package manage the state for package venv
2424
# @param manage_pip_package manage the state for package pip
25+
# @param manage_setuptools if true, install python-setuptools
2526
#
2627
# @example install python from system python
2728
# class { 'python':
@@ -61,6 +62,7 @@
6162
Stdlib::Absolutepath $anaconda_install_path = '/opt/python',
6263
Boolean $manage_scl = true,
6364
Optional[Python::Umask] $umask = undef,
65+
Boolean $manage_setuptools = $facts['os']['family'] ? { 'Archlinux' => true, default => false, },
6466
) inherits python::params {
6567
$exec_prefix = $provider ? {
6668
'scl' => "/usr/bin/scl enable ${version} -- ",

manifests/install.pp

+6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
'Suse' => "${python}-devel",
2525
}
2626

27+
if $python::manage_setuptools {
28+
package { 'python-distutils-extra':
29+
ensure => 'installed',
30+
}
31+
}
32+
2733
if $python::manage_python_package {
2834
package { 'python':
2935
ensure => $python::ensure,

spec/classes/python_spec.rb

+2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919

2020
if facts[:os]['family'] == 'Archlinux'
2121
it { is_expected.not_to contain_package('pip') }
22+
it { is_expected.to contain_package('python-setuptools') }
2223
else
2324
it { is_expected.to contain_package('pip') }
25+
it { is_expected.not_to contain_package('python-setuptools') }
2426
end
2527

2628
if %w[Archlinux RedHat].include?(facts[:os]['family'])

0 commit comments

Comments
 (0)