zuul-jobs/roles/ensure-virtualenv
Ian Wienand 239ace0ebf ensure-virtualenv: Don't support on CentOS 9-stream
It looks like 9-stream don't want to support virtualenv.  Fail the
ensure-virtualenv role on this platform, and account for this in
testing.

People should use ensure-pip and venv which is portable everywhere.

Change-Id: Ifae93c1eeb96792aa26a624574d595d77cb58c4b
2022-02-04 14:45:11 +11:00
..
tasks ensure-virtualenv: Don't support on CentOS 9-stream 2022-02-04 14:45:11 +11:00
README.rst Add ensure-virtualenv 2020-04-28 06:09:54 +00:00

Ensure virtualenv is available

This role installs the requirements for the virtualenv command on the current distribution.

Users should be aware of some portability issues when using virtualenv:

  • Distributions differ on the interpreter that virtualenv is provided by, so by calling virtualenv with no other arguments means that on some platforms you will get a Python 2 environment and others a Python 3 environment.
  • If you wish to call virtualenv as a module (e.g. python -m virtualenv) you will need to know which interpreter owns the virtualenv package for your distribution; e.g. on some, such as Bionic, virtualenv is provided by python3-virtualenv but python refers to Python 2, so python -m virtualenv is not a portable way to call virtualenv.
  • virtualenv -p python3 is likely the most portable way to consistently get a Python 3 environment. virtualenv -p python2 may not work on some platforms without Python 2.
  • If you use Python 3 and do not require the specific features of virtualenv, it is likely easier to use Python's inbuilt python3 -m venv module to create an isolated environment. If you are using pip: in your Ansible roles and require an environment, see the documentation for :zuulensure-pip.