Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to install python-setuptools #699

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -217,6 +218,14 @@ manage the state for package pip

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

##### <a name="-python--manage_setuptools"></a>`manage_setuptools`

Data type: `Boolean`

if true, install python-setuptools

Default value: `$facts['os']['family'] ? { 'Archlinux' => true, default => false`

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

Data type: `Python::Package::Ensure`
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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, },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also just do

Suggested change
Boolean $manage_setuptools = $facts['os']['family'] ? { 'Archlinux' => true, default => false, },
Boolean $manage_setuptools = $facts['os']['family'] == 'Archlinux',

) inherits python::params {
$exec_prefix = $provider ? {
'scl' => "/usr/bin/scl enable ${version} -- ",
Expand Down
6 changes: 6 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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') }

Check failure on line 22 in spec/classes/python_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 (Ruby 3.2)

python on archlinux-6-x86_64 with defaults is expected to contain Package[python-setuptools] Failure/Error: it { is_expected.to contain_package('python-setuptools') } expected that the catalogue would contain Package[python-setuptools]

Check failure on line 22 in spec/classes/python_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 (Ruby 2.7)

python on archlinux-6-x86_64 with defaults is expected to contain Package[python-setuptools] Failure/Error: it { is_expected.to contain_package('python-setuptools') } expected that the catalogue would contain Package[python-setuptools]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it { is_expected.to contain_package('python-setuptools') }
it { is_expected.to contain_package('python-distutils-extra') }

else
it { is_expected.to contain_package('pip') }
it { is_expected.not_to contain_package('python-setuptools') }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it { is_expected.not_to contain_package('python-setuptools') }
it { is_expected.not_to contain_package('python-distutils-extra') }

end

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