<!--
Change how pip version is set for virtual environments to support a user set value (ie pip==9.0.3)
-->
This test currently fails because of https://github.com/voxpupuli/puppet-python/issues/586
<!--
Thank you for contributing to this project!
-->
<!--
Replace this comment with a description of your pull request.
-->
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->
Change regex in python_version
and python_release
facts so it matches python release candidate version (e.g. Python 2.7.16rc1, Python 3.7.3rc1).
modulesync 5.4.0
This limit the quantity of spaghetti code we add when adding support for
another platform.
No functional change.
<!--
Thank you for contributing to this project!
-->
<!--
Pypa has updated its url of get-pip.py recently, so we need to update the url accordingly
-->
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->
<!--
Thank you for contributing to this project!
-->
<!--
Replace this comment with a description of your pull request.
-->
For Ubuntu 18.04 and Debian 10, ensure distutils is installed.
When testing pyvenv I ran into this problem when using Python 3 and noticed if you install python3-venv
instead of python3.7-venv
it pulls in python3-distutils
but rather than changing the behavior of how to install python*-venv
just pulling in the dependency works.
Failure with/without system packages
```
root@debian10:/# python3.7 -m venv --clear --system-site-packages /opt/globus-cli
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/opt/globus-cli/bin/python3.7', '-Im', 'ensurepip', '--upgrade', '--default-pip']
root@debian10:/# python3.7 -m venv --clear /opt/globus-cli
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/opt/globus-cli/bin/python3.7', '-Im', 'ensurepip', '--upgrade', '--default-pip']
```
Solution:
```
root@debian10:/# apt-get install python3.7-distutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python3-distutils' instead of 'python3.7-distutils'
The following packages were automatically installed and are no longer required:
libexpat1-dev libpython-all-dev libpython-dev libpython2-dev libpython2.7 libpython2.7-dev python-all
python2-dev python2.7-dev
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
python3-distutils
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 142 kB of archives.
After this operation, 715 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 python3-distutils all 3.7.3-1 [142 kB]
Fetched 142 kB in 0s (333 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package python3-distutils.
(Reading database ... 42675 files and directories currently installed.)
Preparing to unpack .../python3-distutils3.7.3-1all.deb ...
Unpacking python3-distutils (3.7.3-1) ...
Setting up python3-distutils (3.7.3-1) ...
root@debian10:/# python3.7 -m venv --clear --system-site-packages /opt/globus-cli
root@debian10:/#
```
When trying to install Puppetboard I ran into this module trying to install virtualenv (doesn't exist as a package, only a port) and py3.9-pip
(correct name is py39-pip
).
Replace out the .
in the version name. I did not test this extensively, just enough to get it to compile and install the right package for puppetboard. The origination of of the module doesn't seem to allow an easy way to get a default version based on OS and pass it down to python, pip, etc.
Feedback welcome.
<!--
Thank you for contributing to this project!
-->
This PR provides an optional Parameter for the virtualenv creation. This allows e.g. in airgapped environments to specify a private pip index as source for the pip and setuptools packages
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
<!--
Thank you for contributing to this project!
-->
<!--
Replace this comment with a description of your pull request.
-->
<!--
Replace this comment with the list of issues or n/a.
Use format:
Fixes #123
Fixes #124
-->
Fix the resolution of the latest version from the pip repository, by removing the pre-release version from the list of the latest package available. See #690 for details.
~~I’ve added a boolean parameter pre_release
.
It should be used instead of install_args => '--pre'
for the ensure => latest
to be aware of the version.
I chose to add this parameter instead of trying to parse the install_args
parameter.~~
~~The new pip version (24.1b2) does not support notreallyaversion
as a package version. I used 0.0
as replacement~~
EDIT: I’ve reused the version that was changed in master.
bash
:~$ pip --version
pip 24.1b2 from /opt/puppetapi/lib64/python3.9/site-packages/pip (python 3.9)
:~$ pip install pip==notreallyaversion
ERROR: Invalid requirement: 'pip==notreallyaversion': Expected end or semicolon (after name and no valid version specifier)
pip==notreallyaversion
^
:~$ pip install pip==0.0
ERROR: Ignored the following yanked versions: 20.0, 20.3.2, 21.2
ERROR: Could not find a version that satisfies the requirement pip==0.0 (from versions: 0.2, 0.2.1, 0.3, 0.3.1, 0.4, 0.5, 0.5.1, 0.6, 0.6.1, 0.6.2, 0.6.3, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.8.2, 0.8.3, 1.0, 1.0.1, 1.0.2, 1.1, 1.2, 1.2.1, 1.3, 1.3.1, 1.4, 1.4.1, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 6.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.1.0, 6.1.1, 7.0.0, 7.0.1, 7.0.2, 7.0.3, 7.1.0, 7.1.1, 7.1.2, 8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.1.0, 8.1.1, 8.1.2, 9.0.0, 9.0.1, 9.0.2, 9.0.3, 10.0.0b1, 10.0.0b2, 10.0.0, 10.0.1, 18.0, 18.1, 19.0, 19.0.1, 19.0.2, 19.0.3, 19.1, 19.1.1, 19.2, 19.2.1, 19.2.2, 19.2.3, 19.3, 19.3.1, 20.0.1, 20.0.2, 20.1b1, 20.1, 20.1.1, 20.2b1, 20.2, 20.2.1, 20.2.2, 20.2.3, 20.2.4, 20.3b1, 20.3, 20.3.1, 20.3.3, 20.3.4, 21.0, 21.0.1, 21.1, 21.1.1, 21.1.2, 21.1.3, 21.2.1, 21.2.2, 21.2.3, 21.2.4, 21.3, 21.3.1, 22.0, 22.0.1, 22.0.2, 22.0.3, 22.0.4, 22.1b1, 22.1, 22.1.1, 22.1.2, 22.2, 22.2.1, 22.2.2, 22.3, 22.3.1, 23.0, 23.0.1, 23.1, 23.1.1, 23.1.2, 23.2, 23.2.1, 23.3, 23.3.1, 23.3.2, 24.0, 24.1b1, 24.1b2)
ERROR: No matching distribution found for pip==0.0
Fixes #690
Install python packages from dedicated classes of the module.
This allow to use a single python profile in a control-repo that does not enforce installation / removal of these packages and still allow modules to require them.
```puppet
class foo {
include python
include python::install::dev
# ...
}
class bar {
include python
include python::install::venv
# ...
}
class profile::python {
class { 'python':
dev => 'present',
pip => 'present',
venv => 'present',
managedevpackage => false,
managepippackage => false,
managevenvpackage => false,
# ... site specific config
}
}
class profile::foo {
include profile::python
class { 'foo':
}
}
class profile::bar {
include profile::python
class { 'bar':
}
}
```
If a node is classified profile::foo
, the python-dev
package will be installed. If a node is classified profile::bar
, the python-venv
package will be installed. Other python-*
packages are not managed.
This is part 2/3 of #668 and does not introduce functional change. However it permits new usages and therefore is labelled enhancement.
Part 3/3 will be backwards-incompatible in order to change the defaults of the python
class to match those in the above example.
Also include:
* #669