Replace virtualenv with exacutable for pip

We create virtualenv with a separate command since we need to create
constraints before running pip. In the meanwhile when using pyenv
it becomes more messy to use virtualenv, as it would require
setting virtualenv_command and you can't define virtualenv_python then.

Using exacutable requires setuptools to be present
for ansible_python_interpreter

Change-Id: I5bf617ad0eca3dd5e58e25af7b44d536dc4579d3
This commit is contained in:
Dmitriy Rabotyagov 2021-12-27 10:17:28 +02:00
parent a70aba465e
commit 8701591120
3 changed files with 6 additions and 4 deletions

View File

@ -55,7 +55,7 @@
- name: Create the virtualenv (if it does not exist)
command: >-
{{ venv_python_executable }}
{{ venv_python_executable }}
-m venv
{{ venv_install_destination_path }}
args:
@ -129,7 +129,7 @@
- setuptools
- wheel
state: "{{ venv_pip_package_state }}"
virtualenv: "{{ venv_install_destination_path }}"
executable: "{{ venv_install_destination_path }}/bin/pip"
extra_args: >-
--constraint {{ venv_install_destination_path }}/global-constraints.txt
--constraint {{ venv_install_destination_path }}/constraints.txt
@ -151,7 +151,7 @@
pip:
name: "{{ _venv_install_pip_packages }}"
state: "{{ venv_pip_package_state }}"
virtualenv: "{{ venv_install_destination_path }}"
executable: "{{ venv_install_destination_path }}/bin/pip"
extra_args: >-
--constraint {{ venv_install_destination_path }}/global-constraints.txt
--constraint {{ venv_install_destination_path }}/constraints.txt

View File

@ -105,7 +105,7 @@
- setuptools
- wheel
state: "{{ venv_pip_package_state }}"
virtualenv: "{{ venv_build_host_venv_path }}"
executable: "{{ venv_build_host_venv_path }}/bin/pip"
extra_args: >-
--constraint {{ _venv_build_requirements_prefix }}-global-constraints.txt
--constraint {{ _venv_build_requirements_prefix }}-source-constraints.txt

View File

@ -20,6 +20,7 @@ _venv_build_base_distro_package_list:
- "{{ (venv_python_executable == 'python2') | ternary('pkg-config', 'python3-pkgconfig') }}"
- "{{ (venv_python_executable == 'python2') | ternary('python-dev', 'python3-dev') }}"
- python3-venv
- python3-setuptools
redhat:
- autoconf
- cmake
@ -30,6 +31,7 @@ _venv_build_base_distro_package_list:
_venv_install_base_distro_package_list:
debian:
- python3-venv
- python3-setuptools
redhat: []
# Set the available build targets for all nodes within an environment.