zuul-jobs/roles/ensure-python/tasks/main.yaml
Dmitriy Rabotyagov 3faa27fd2d Add support to use stow for ensure-python
In case image is prepared with python-stow-versions element,
it make sense to use stow to just enable required python version instead
of building it for each job run.

Change-Id: Ie04a2bb59d351c1e5c79b2da79f7a094c44cdf86
2020-09-24 07:39:52 +00:00

31 lines
825 B
YAML

- name: Validate python_version value
assert:
that:
- (python_version|string).split(".") | length == 2
- (python_version|string).split(".")[0]
- (python_version|string).split(".")[1]
when: python_version is defined
- name: Install specified version of python interpreter and development files
when:
- python_version is defined
- ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- not python_use_pyenv
- not python_use_stow
package:
name: python{{ python_version }}-dev
state: present
become: yes
- name: Install python using pyenv
when:
- python_version is defined
- python_use_pyenv
include_tasks: pyenv.yaml
- name: Activate python using stow
when:
- python_version is defined
- python_use_stow
include_tasks: stow.yaml