Skip to content

Commit

Permalink
Merge pull request #79 from edx/nadeem/dos-5283
Browse files Browse the repository at this point in the history
feat: Add Python 3.12 support to Django IDA's
  • Loading branch information
nadeemshahzad authored Oct 17, 2024
2 parents a3047ef + 8d5e963 commit b03f045
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions playbooks/roles/analytics_api/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ analytics_api_newrelic_appname: 'analytics-api'
analytics_api_debian_pkgs:
- 'libmysqlclient-dev'

ANALYTICS_API_USE_PYTHON12: False

ANALYTICS_API_USE_PYTHON38: True

ANALYTICS_API_VERSION: "master"
Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/analytics_api/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

dependencies:
- role: edx_django_service
edx_django_service_use_python312: '{{ ANALYTICS_API_USE_PYTHON12 }}'
edx_django_service_use_python38: '{{ ANALYTICS_API_USE_PYTHON38 }}'
edx_django_service_repos: '{{ ANALYTICS_API_REPOS }}'
edx_django_service_name: '{{ analytics_api_service_name }}'
Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/edx_django_service/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions playbooks/roles/edx_django_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions playbooks/roles/edx_service/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
25 changes: 25 additions & 0 deletions playbooks/roles/edx_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b03f045

Please sign in to comment.