From ab4042e60a5d1474438ffedd12ecfe9ea6d6338a Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 3 Feb 2022 16:30:47 +1100 Subject: [PATCH] ensure-sphinx: Use python3 All our platforms are Python 3 now, so we can simplify this. We can remove the virtualenv dependency as ensure-pip installs venv and sets variables for us to use it when making a virtualenv. Change-Id: I98c3da5b02a4ac7fb9d7bd8e00170762e77b9f40 --- roles/ensure-sphinx/README.rst | 5 +++-- roles/ensure-sphinx/defaults/main.yaml | 5 +++-- roles/ensure-sphinx/tasks/main.yaml | 11 ++--------- roles/ensure-sphinx/vars/python2.yaml | 2 -- roles/ensure-sphinx/vars/python3.yaml | 2 -- 5 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 roles/ensure-sphinx/vars/python2.yaml delete mode 100644 roles/ensure-sphinx/vars/python3.yaml diff --git a/roles/ensure-sphinx/README.rst b/roles/ensure-sphinx/README.rst index f7a97cd18..ca337ffd8 100644 --- a/roles/ensure-sphinx/README.rst +++ b/roles/ensure-sphinx/README.rst @@ -25,9 +25,10 @@ All pip installs are done with a provided constraints file, if given. By default this list is empty. .. zuul:rolevar:: sphinx_python - :default: python2 + :default: python3 - Version of python to use, either ``python2`` or ``python3``. + **Deprecated** + Version of python to use, only supports ``python3``. .. zuul:rolevar:: zuul_work_virtualenv :default: ~/.venv diff --git a/roles/ensure-sphinx/defaults/main.yaml b/roles/ensure-sphinx/defaults/main.yaml index 83b224055..56b622f86 100644 --- a/roles/ensure-sphinx/defaults/main.yaml +++ b/roles/ensure-sphinx/defaults/main.yaml @@ -1,5 +1,6 @@ zuul_work_dir: "{{ zuul.project.src_dir }}" zuul_work_virtualenv: "{{ ansible_user_dir }}/.venv" -sphinx_python: python2 -doc_building_packages: "{{ _doc_building_packages | default([]) }}" +sphinx_python: python3 +doc_building_packages: + - sphinx doc_building_extra_packages: [] diff --git a/roles/ensure-sphinx/tasks/main.yaml b/roles/ensure-sphinx/tasks/main.yaml index a9d318ff7..fb1425f09 100644 --- a/roles/ensure-sphinx/tasks/main.yaml +++ b/roles/ensure-sphinx/tasks/main.yaml @@ -2,10 +2,6 @@ include_role: name: ensure-pip -- name: Install virtualenv - include_role: - name: ensure-virtualenv - # NOTE: gettext command is provided by gettext-base package, # so we need to check a command provided by gettext package. - name: Check for gettext installed @@ -41,15 +37,12 @@ done register: requirements_file -- name: Gather python version variables - include_vars: "{{ sphinx_python.split('.')[0] }}.yaml" - - name: Install base doc building packages pip: name: "{{ doc_building_packages | union(doc_building_extra_packages) }}" chdir: "{{ zuul_work_dir }}" virtualenv: "{{ zuul_work_virtualenv }}" - virtualenv_python: "{{ sphinx_python }}" + virtualenv_command: "{{ ensure_pip_virtualenv_command }}" extra_args: "{{ upper_constraints | default(omit) }}" - name: Install found doc requirements @@ -57,6 +50,6 @@ requirements: "{{ requirements_file.stdout }}" chdir: "{{ zuul_work_dir }}" virtualenv: "{{ zuul_work_virtualenv }}" - virtualenv_python: "{{ sphinx_python }}" + virtualenv_command: "{{ ensure_pip_virtualenv_command }}" extra_args: "{{ upper_constraints | default(omit) }}" when: requirements_file.stdout_lines diff --git a/roles/ensure-sphinx/vars/python2.yaml b/roles/ensure-sphinx/vars/python2.yaml deleted file mode 100644 index ab8dbc2cc..000000000 --- a/roles/ensure-sphinx/vars/python2.yaml +++ /dev/null @@ -1,2 +0,0 @@ -_doc_building_packages: - - sphinx<2.0 diff --git a/roles/ensure-sphinx/vars/python3.yaml b/roles/ensure-sphinx/vars/python3.yaml deleted file mode 100644 index ec2e3b182..000000000 --- a/roles/ensure-sphinx/vars/python3.yaml +++ /dev/null @@ -1,2 +0,0 @@ -_doc_building_packages: - - sphinx