Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
- Puppet >= 6.21.0 < 8.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'visus-pythonbuild', '0.1.2'
Learn more about managing modules with a PuppetfileDocumentation
pythonbuild
This module installs Python from source by downloading it from Python.org and performing an altinstall.
Table of Contents
- Description
- Setup – The basics of getting started with pythonbuild
- Usage – Configuration options and additional functionality
- Limitations – OS compatibility, etc.
- Development – Guide for contributing to the module
Description
This module downloads Python sources from the configured URL, by default from
the FTP directory on Python.org, into a configured directory, be default
/usr/local/src'. Afterwards, it configures the build and performs a
altinstall` make.
This process will install a binary that can be invoked, for instance, as
python3.9
.
Setup
Setup Requirements
The module required autoconf, gcc, make and several libraries to be installed.
These packages are automatically installed when specified in as
$build_dependencies
.
Beginning with pythonbuild
The pythonbuild
class enables installation of multiple versions. The following
installs Python 3.9.6 without any build customisation:
class { 'pythonbuild':
versions => {
'3.9.6' => { }
}
}
Usage
The hash per version can be used to configure phythonbuild::build
, most
notably you can override the full source path for the download. Furthermore, you
can change the target for make, e.g. if you want to perform a system-wide install
instead of adding an alternative version. The following specifies what would be
the default for Python 3.9.6:
class { 'pythonbuild':
versions => {
'3.9.6' => {
override_url => 'https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz',
configure_flags => '--enable-optimizations',
make_target => 'altinstall'
}
}
}
Should you have the need to add additional build depdencies, this is best done via Hiera. The following is the default configuration which is applied to all platforms:
pythonbuild::build_dependencies:
- gcc
- make
- autoconf
If you need to force a rebuild, this can be achieved by deleting the source
directory. This is located in /usr/local/src
or at the location specified as
$source_dir
parameter.
Limitations
Only distributions listed in metadata.json
are supported.
Development
Open a pull request on GitHub.
Reference
Table of Contents
Classes
pythonbuild
: Installs Python from source.
Defined types
Public Defined types
Private Defined types
pythonbuild::build
: Builds and installs a single version of Python.
Classes
pythonbuild
This module downloads Python sources from python.org and builds and installs the Python interpreter from there.
Parameters
The following parameters are available in the pythonbuild
class:
source_dir
Data type: String
The directory where to download and extract the sources to.
Default value: '/usr/local/src'
base_url
Data type: String
The base URL where the Python sources are downloaded from. This defaults to the FTP directory on python.org.
Default value: 'https://www.python.org/ftp/python'
build_dependencies
Data type: Array[String]
A list of packages that need to be installed in order to successfully build Python. These dependencies should be specified via Hiera.
versions
Data type: Hash[String, Hash[String, Variant[String, Integer, Boolean]]]
The Python versions to be downloaded and installed. The keys of the hash are the version numbers. The values are a hash holding additional parameters passed to the build process. At the moment, only "override_url" is supported, which forces the download from the specified URL rather than constructing the URL from the base_url and the version string.
Default value: { }
Defined types
Dependencies
- puppetlabs/stdlib (>=5.2.0 <=7.1.0)