python3-env: Install wheel packages if required.

This commit is contained in:
Andrea Dell'Amico 2020-05-17 18:10:01 +02:00
parent 60de429172
commit 480580c99e
2 changed files with 24 additions and 10 deletions

View File

@ -16,6 +16,11 @@ py3_env_dpkg:
- 'python{{ py3_env_version }}-venv' - 'python{{ py3_env_version }}-venv'
- 'python{{ py3_env_version }}-dev' - 'python{{ py3_env_version }}-dev'
py3_env_pip_default_pkgs:
- 'pip'
- 'setuptools'
- 'wheel'
py3_env_wheel_pip_pkgs: []
py3_env_pip_pkgs: [] py3_env_pip_pkgs: []
py3_env_versioned_pip_pkgs: [] py3_env_versioned_pip_pkgs: []

View File

@ -20,24 +20,33 @@
shell: python{{ py3_env_version }} -m ensurepip && pip{{ py3_env_version }} install --upgrade pip setuptools wheel shell: python{{ py3_env_version }} -m ensurepip && pip{{ py3_env_version }} install --upgrade pip setuptools wheel
when: ansible_distribution_version is version_compare('18.04', '<') when: ansible_distribution_version is version_compare('18.04', '<')
- name: Install a list of pip packages - name: Install a list of versioned pip3 packages on Ubuntu older than Trusty
pip: executable=pip{{ py3_env_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
when: ansible_distribution_version is version_compare('18.04', '<')
- name: Install a list of pip packages
pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
when: ansible_distribution_version is version_compare('18.04', '>=')
- name: Install a list of versioned pip packages
pip: executable=pip{{ py3_env_version }} name={{ item.pkg }} version={{ item.version }} pip: executable=pip{{ py3_env_version }} name={{ item.pkg }} version={{ item.version }}
with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}' with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}'
when: ansible_distribution_version is version_compare('18.04', '<') when: ansible_distribution_version is version_compare('18.04', '<')
- name: Install a list of versioned pip packages - name: Install a list of pip3 packages on Ubuntu older than Trusty
pip: executable=pip{{ py3_env_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
when: ansible_distribution_version is version_compare('18.04', '<')
- name: Ensure that we have the latest pip, setuptools and wheel versions
pip:
executable: 'pip{{ py3_env_major_version }}'
name: '{{ py3_env_pip_default_pkgs }}'
state: latest
- name: Install a list of binary pip3 packages in wheels format
pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_wheel_pip_pkgs }} state={{ py3_pip_pkgs_state }}
- name: Install a list of versioned pip3 packages on Ubuntu Bionic or newer
pip: executable=pip{{ py3_env_major_version }} name={{ item.pkg }} version={{ item.version }} pip: executable=pip{{ py3_env_major_version }} name={{ item.pkg }} version={{ item.version }}
with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}' with_items: '{{ py3_env_versioned_pip_pkgs | default ([]) }}'
when: ansible_distribution_version is version_compare('18.04', '>=') when: ansible_distribution_version is version_compare('18.04', '>=')
- name: Install a list of pip3 packages on Ubuntu Bionic or newer
pip: executable=pip{{ py3_env_major_version }} name={{ py3_env_pip_pkgs }} state={{ py3_pip_pkgs_state }}
when: ansible_distribution_version is version_compare('18.04', '>=')
when: py3_env_install when: py3_env_install
tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ] tags: [ "python", "py3_env", "py3_env_pkgs", 'python3' ]