From cb3b7cbea16591bb36d7aad37aa3b6e1c7e9fa7d Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Mon, 11 Nov 2024 22:56:39 +0500 Subject: [PATCH] build: add support for Python 3.11 --- .../edx_django_service/defaults/main.yml | 1 + .../roles/edx_django_service/tasks/main.yml | 25 +++++++++++++++++++ playbooks/roles/edx_service/defaults/main.yml | 1 + playbooks/roles/edx_service/tasks/main.yml | 25 +++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/playbooks/roles/edx_django_service/defaults/main.yml b/playbooks/roles/edx_django_service/defaults/main.yml index 086c30e8335..31f2c3e5a80 100644 --- a/playbooks/roles/edx_django_service/defaults/main.yml +++ b/playbooks/roles/edx_django_service/defaults/main.yml @@ -5,6 +5,7 @@ edx_django_service_home: '{{ COMMON_APP_DIR }}/{{ edx_django_service_name }}' edx_django_service_user: '{{ edx_django_service_name }}' edx_django_service_use_python3: true edx_django_service_use_python38: false +edx_django_service_use_python311: false edx_django_service_use_python312: false # This should be overwritten at the time Ansible is run. diff --git a/playbooks/roles/edx_django_service/tasks/main.yml b/playbooks/roles/edx_django_service/tasks/main.yml index ca946021f84..a431df3e31e 100644 --- a/playbooks/roles/edx_django_service/tasks/main.yml +++ b/playbooks/roles/edx_django_service/tasks/main.yml @@ -61,6 +61,21 @@ - install - install:configuration +- name: install python3.11 + apt: + pkg: + - python3.11-dev + - python3.11-distutils + update_cache: yes + register: install_pkgs + until: install_pkgs is success + retries: 10 + delay: 5 + when: edx_django_service_use_python311 and not edx_django_service_enable_experimental_docker_shim + tags: + - install + - install:system-requirements + - name: install python3.12 apt: pkg: @@ -107,6 +122,16 @@ - install - install:system-requirements +- name: build virtualenv with python3.11 + command: "virtualenv --python=python3.11 {{ edx_django_service_venv_dir }}" + args: + creates: "{{ edx_django_service_venv_dir }}/bin/pip" + become_user: "{{ edx_django_service_user }}" + when: edx_django_service_use_python311 and not edx_django_service_enable_experimental_docker_shim + tags: + - install + - install:system-requirements + - name: build virtualenv with python3.12 command: "virtualenv --python=python3.12 {{ edx_django_service_venv_dir }}" args: diff --git a/playbooks/roles/edx_service/defaults/main.yml b/playbooks/roles/edx_service/defaults/main.yml index 23be44f8aa4..e099d86dfa6 100644 --- a/playbooks/roles/edx_service/defaults/main.yml +++ b/playbooks/roles/edx_service/defaults/main.yml @@ -40,6 +40,7 @@ edx_service_decrypt_config_enabled: false edx_service_copy_config_enabled: false edx_service_use_python312: false +edx_service_use_python311: false edx_service_use_python38: false edx_service_use_python3: false edx_service_venv_dir: "{{ edx_service_home }}/venvs/{{ edx_service_name }}" diff --git a/playbooks/roles/edx_service/tasks/main.yml b/playbooks/roles/edx_service/tasks/main.yml index 53f769deb05..9e69dc8415c 100644 --- a/playbooks/roles/edx_service/tasks/main.yml +++ b/playbooks/roles/edx_service/tasks/main.yml @@ -130,6 +130,21 @@ - install:configuration - install:app-configuration +- name: Install Python 3.11 + apt: + pkg: + - python3.11-dev + - python3.11-distutils + update_cache: yes + register: install_pkgs + until: install_pkgs is success + retries: 10 + delay: 5 + when: edx_service_use_python311 + tags: + - install + - install:system-requirements + - name: Install Python 3.12 apt: pkg: @@ -176,6 +191,16 @@ - install - install:system-requirements +- name: Build virtualenv with Python 3.11 + command: "virtualenv --python=python3.11 {{ edx_service_venv_dir }}" + args: + creates: "{{ edx_service_venv_dir }}/bin/pip" + become_user: "{{ edx_service_user }}" + when: edx_service_use_python311 + tags: + - install + - install:system-requirements + - name: Build virtualenv with Python 3.12 command: "virtualenv --python=python3.12 {{ edx_service_venv_dir }}" args: