Skip to content

Commit

Permalink
Merge pull request #24 from gforcada/python-313
Browse files Browse the repository at this point in the history
Add python 3.13
  • Loading branch information
gforcada committed May 11, 2024
2 parents 11124f9 + 0a69842 commit 9fbc8fc
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 154 deletions.
8 changes: 4 additions & 4 deletions ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
roles:
- ansible-compile-python
vars:
- python_24: true
- python_26: true
- pillow: true
- lxml: true
python_24: true
python_26: true
pillow: true
lxml: true
59 changes: 36 additions & 23 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ python_39: false
python_310: false
python_311: false
python_312: true
python_313: false

pillow: false
lxml: false
Expand All @@ -38,6 +39,7 @@ versions:
py310: "3.10.14"
py311: "3.11.9"
py312: "3.12.3"
py313: "3.13.0b1" # on a final release, the url path needs to be adjusted

hashes:
py24: "76083277f6c7e4d78992f36d7ad9018d"
Expand All @@ -55,6 +57,7 @@ hashes:
py310: "05148354ce821ba7369e5b7958435400"
py311: "22ea467e7d915477152e99d5da856ddc"
py312: "8defb33f0c37aa4bdd3a38ba52abde4e"
py313: "e1208b22c67c77de72a5e20025b2fb53"

venv_versions:
py24: "1.7.2"
Expand All @@ -68,6 +71,30 @@ base_install_folder: "/srv"
ftp_url: "https://www.python.org/ftp/python"
pkg_url: "https://files.pythonhosted.org/packages"

venv24:
version: "{{ venv_versions.py24 }}"
file_hash: "7b88d35d0a353ec70e42aa37fd8b0bd1c643419c80f022ffaafa4d6449f0"
url: "{{ pkg_url }}/16/86/{{ file_hash }}/virtualenv-1.7.2.tar.gz"
md5: "b5d63b05373a4344ae099a68875aae78"
tar_file: "/tmp/virtualenv-{{ venv_versions.py24 }}.tar.gz"
sources: "/tmp/virtualenv-{{ venv_versions.py24 }}"

venv26:
version: "{{ venv_versions.py26 }}"
file_hash: "f425e456e017af4801bb08920e30c149a44ac0c194f2225bdb712e77701c"
url: "{{ pkg_url }}/d5/5b/{{ file_hash }}/virtualenv-1.10.tar.gz"
md5: "9745c28256c70c76d36adb3767a00212"
tar_file: "/tmp/virtualenv-{{ venv_versions.py26 }}.tar.gz"
sources: "/tmp/virtualenv-{{ venv_versions.py26 }}"

venv27:
version: "{{ venv_versions.py27 }}"
file_hash: "706af3ee62032933a3217454609c50a5325a6bd9c2c2f495b58c456ba286"
url: "{{ pkg_url }}/37/27/{{ file_hash }}/virtualenv-16.6.1.tar.gz"
md5: "b05b03dc6ecb3caaa3d58bfcccf4e786"
tar_file: "/tmp/virtualenv-{{ venv_versions.py27 }}.tar.gz"
sources: "/tmp/virtualenv-{{ venv_versions.py27 }}"

py24:
version: "{{ versions.py24 }}"
major_version: "2.4"
Expand Down Expand Up @@ -218,26 +245,12 @@ py312:
install: "{{ base_install_folder }}/python{{ versions.py312 }}"
bin: "{{ base_install_folder }}/python{{ versions.py312 }}/bin/python3.12"

venv24:
version: "{{ venv_versions.py24 }}"
file_hash: "7b88d35d0a353ec70e42aa37fd8b0bd1c643419c80f022ffaafa4d6449f0"
url: "{{ pkg_url }}/16/86/{{ file_hash }}/virtualenv-1.7.2.tar.gz"
md5: "b5d63b05373a4344ae099a68875aae78"
tar_file: "/tmp/virtualenv-{{ venv_versions.py24 }}.tar.gz"
sources: "/tmp/virtualenv-{{ venv_versions.py24 }}"

venv26:
version: "{{ venv_versions.py26 }}"
file_hash: "f425e456e017af4801bb08920e30c149a44ac0c194f2225bdb712e77701c"
url: "{{ pkg_url }}/d5/5b/{{ file_hash }}/virtualenv-1.10.tar.gz"
md5: "9745c28256c70c76d36adb3767a00212"
tar_file: "/tmp/virtualenv-{{ venv_versions.py26 }}.tar.gz"
sources: "/tmp/virtualenv-{{ venv_versions.py26 }}"

venv27:
version: "{{ venv_versions.py27 }}"
file_hash: "706af3ee62032933a3217454609c50a5325a6bd9c2c2f495b58c456ba286"
url: "{{ pkg_url }}/37/27/{{ file_hash }}/virtualenv-16.6.1.tar.gz"
md5: "b05b03dc6ecb3caaa3d58bfcccf4e786"
tar_file: "/tmp/virtualenv-{{ venv_versions.py27 }}.tar.gz"
sources: "/tmp/virtualenv-{{ venv_versions.py27 }}"
py313:
version: "{{ versions.py313 }}"
major_version: "3.13"
url: "{{ ftp_url }}/3.13.0/Python-{{ versions.py313 }}.tar.xz"
md5: "{{ hashes.py313 }}"
tar_file: "/tmp/py{{ versions.py313 }}.tar.xz"
sources: "/tmp/Python-{{ versions.3.13 }}"
install: "{{ base_install_folder }}/python{{ versions.3.13 }}"
bin: "{{ base_install_folder }}/python{{ versions.3.13 }}/bin/python3.13"
124 changes: 6 additions & 118 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,126 +3,14 @@
- name: Install dependencies
ansible.builtin.import_tasks: deps.yml

- name: Install Python 2.4
ansible.builtin.import_tasks: python24.yml
- name: Install Python 2.x
ansible.builtin.import_tasks: python2x.yml

- name: Install Python 2.6
ansible.builtin.import_tasks: python26.yml
- name: Install Python 3.x
ansible.builtin.import_tasks: python3x.yml

- name: Install Python 2.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py27 }}"
when: python_27

- name: Install Python 3.1
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py31 }}"
when: python_31

- name: Install Python 3.2
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py32 }}"
when: python_32

- name: Install Python 3.3
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py33 }}"
when: python_33

- name: Install Python 3.4
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py34 }}"
when: python_34

- name: Install Python 3.5
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py35 }}"
when: python_35

- name: Install Python 3.6
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py36 }}"
when: python_36

- name: Install Python 3.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py37 }}"
when: python_37

- name: Install Python 3.8
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py38 }}"
when: python_38

- name: Install Python 3.9
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py39 }}"
when: python_39

- name: Install Python 3.10
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py310 }}"
when: python_310

- name: Install Python 3.11
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py311 }}"
when: python_311

- name: Install Python 3.12
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py312
when: python_312

- name: Install Virtualenv for Python 2.4
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py24
venv_data: venv24
when: python_24

- name: Install Virtualenv for Python 2.6
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py26
venv_data: venv26
when: python_26

- name: Install Virtualenv for Python 2.7
ansible.builtin.include_tasks:
file: venv.yml
vars:
py_data: py27
venv_data: venv27
when: python_27
- name: Install virtualenvs
ansible.builtin.import_tasks: venvs.yml

- name: Miscellaneous
ansible.builtin.import_tasks: misc.yml
14 changes: 14 additions & 0 deletions tasks/python2x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

- name: Install Python 2.4
ansible.builtin.import_tasks: python24.yml

- name: Install Python 2.6
ansible.builtin.import_tasks: python26.yml

- name: Install Python 2.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py27 }}"
when: python_27
92 changes: 92 additions & 0 deletions tasks/python3x.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---

- name: Install Python 3.1
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py31 }}"
when: python_31

- name: Install Python 3.2
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py32 }}"
when: python_32

- name: Install Python 3.3
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py33 }}"
when: python_33

- name: Install Python 3.4
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py34 }}"
when: python_34

- name: Install Python 3.5
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py35 }}"
when: python_35

- name: Install Python 3.6
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py36 }}"
when: python_36

- name: Install Python 3.7
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py37 }}"
when: python_37

- name: Install Python 3.8
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py38 }}"
when: python_38

- name: Install Python 3.9
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py39 }}"
when: python_39

- name: Install Python 3.10
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py310 }}"
when: python_310

- name: Install Python 3.11
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: "{{ py311 }}"
when: python_311

- name: Install Python 3.12
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py312
when: python_312

- name: Install Python 3.13
ansible.builtin.include_tasks:
file: python_generic.yml
vars:
py_data: py313
when: python_313
10 changes: 5 additions & 5 deletions tasks/python_generic.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
---

- name: "{{ py_data.version }} | Check that it is still not installed"
- name: "Python | Check that it is still not installed | {{ py_data.version }}"
become: true
ansible.builtin.stat:
path: "{{ py_data.bin }}"
register: already_installed
ignore_errors: true

- name: "{{ py_data.version }} | Download"
- name: "Python | Download | {{ py_data.version }}"
ansible.builtin.get_url:
url: "{{ py_data.url }}"
dest: "{{ py_data.tar_file }}"
checksum: "md5:{{ py_data.md5 }}"
mode: "0440"
when: not already_installed.stat.exists

- name: "{{ py_data.version }} | Uncompress"
- name: "Python | Uncompress | {{ py_data.version }}"
ansible.builtin.unarchive:
src: "{{ py_data.tar_file }}"
dest: /tmp
copy: false
creates: "{{ py_data.sources }}"
when: not already_installed.stat.exists

- name: "{{ py_data.version }} | Compile and install"
- name: "Python | Compile and install | {{ py_data.version }}"
become: true
ansible.builtin.command: "{{ item }}"
args:
Expand All @@ -36,7 +36,7 @@
register: output
changed_when: output.rc != 0

- name: "{{ py_data.version }} | Create python_major_version symlink"
- name: "Python | Create symlink | {{ py_data.version }}"
become: true
ansible.builtin.file:
src: "{{ py_data.install }}"
Expand Down

0 comments on commit 9fbc8fc

Please sign in to comment.