From c4fb760da2b49a69ba4967ad3074aa95f6083aca Mon Sep 17 00:00:00 2001 From: nadeemshahzad Date: Thu, 17 Oct 2024 15:37:09 +0500 Subject: [PATCH] feat: python 3.12 support --- .../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 e359616b3b1..086c30e8335 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_python312: false # This should be overwritten at the time Ansible is run. edx_django_service_is_devstack: false diff --git a/playbooks/roles/edx_django_service/tasks/main.yml b/playbooks/roles/edx_django_service/tasks/main.yml index 18c3cfd1925..ca946021f84 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.12 + apt: + pkg: + - python3.12-dev + - python3.12-distutils + update_cache: yes + register: install_pkgs + until: install_pkgs is success + retries: 10 + delay: 5 + when: edx_django_service_use_python312 and not edx_django_service_enable_experimental_docker_shim + tags: + - install + - install:system-requirements + - name: install python3.8 apt: pkg: @@ -92,6 +107,16 @@ - install - install:system-requirements +- name: build virtualenv with python3.12 + command: "virtualenv --python=python3.12 {{ 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_python312 and not edx_django_service_enable_experimental_docker_shim + tags: + - install + - install:system-requirements + - name: build virtualenv with python3.8 command: "virtualenv --python=python3.8 {{ 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 99eef1aaa7a..23be44f8aa4 100644 --- a/playbooks/roles/edx_service/defaults/main.yml +++ b/playbooks/roles/edx_service/defaults/main.yml @@ -39,6 +39,7 @@ edx_service_local_config_file: "{{ UNENCRYPTED_CFG_DIR }}/{{ edx_service_name }} edx_service_decrypt_config_enabled: false edx_service_copy_config_enabled: false +edx_service_use_python312: 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 ca733b30d79..53f769deb05 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.12 + apt: + pkg: + - python3.12-dev + - python3.12-distutils + update_cache: yes + register: install_pkgs + until: install_pkgs is success + retries: 10 + delay: 5 + when: edx_service_use_python312 + tags: + - install + - install:system-requirements + - name: Install Python 3.8 apt: pkg: @@ -161,6 +176,16 @@ - install - install:system-requirements +- name: Build virtualenv with Python 3.12 + command: "virtualenv --python=python3.12 {{ edx_service_venv_dir }}" + args: + creates: "{{ edx_service_venv_dir }}/bin/pip" + become_user: "{{ edx_service_user }}" + when: edx_service_use_python312 + tags: + - install + - install:system-requirements + - name: Build virtualenv with Python 3.8 command: "virtualenv --python=python3.8 {{ edx_service_venv_dir }}" args: