From 9f87beb9c9b5283aaa225d14dbc4d27818c3c6ad Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 5 Apr 2023 13:02:43 -0500 Subject: [PATCH] workaround python2 being unavailable --- roles/kalite/tasks/install.yml | 6 +++++- scripts/install_python2.sh | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 scripts/install_python2.sh diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 5fb192475..6eb69859c 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -17,9 +17,13 @@ - python-setuptools # Provides setuptools-44 on recent OS's (last version compatible with python2) - virtualenv # Drags in 'python3-virtualenv' which in turn drags in 'python3-pip' -- for Ansible module 'pip' when used with 'virtualenv_command: /usr/bin/virtualenv' and 'virtualenv_python: python2.7' -- compare package 'python3-venv' used by roles {calibre-web, jupyterhub, lokole} state: present - #when: not (is_debian_9 or is_debian_10 or is_ubuntu_16 or is_ubuntu_17 or is_ubuntu_18 or is_ubuntu_19) + when: not (is_debian_12 or is_ubuntu_2304) # 2020-03-31: Testing for {is_raspbian_9, is_raspbian_10} is not currently nec, as testing for {is_debian_9, is_debian_10} covers that already. +- name: Use scripts/install_python2.sh to install python2 and virtualenv + command: "{{ iiab_dir }}/scripts/install_python2.sh" + when: is_debian_12 or is_ubuntu_2304 + - name: Use pip to pin setuptools to 44 in {{ kalite_venv }} # WAS: if Raspbian/Debian > 10 or Ubuntu > 19 pip: name: setuptools==44 diff --git a/scripts/install_python2.sh b/scripts/install_python2.sh new file mode 100755 index 000000000..c21ec2ae8 --- /dev/null +++ b/scripts/install_python2.sh @@ -0,0 +1,25 @@ +#!/bin/bash +ARCH=$(dpkg --print-architecture) +cd /tmp +case $ARCH in + "arm64") + wget http://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8_arm64.deb + apt install ./libpython2.7-minimal_2.7.18-8_arm64.deb + wget http://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8_arm64.deb + apt install ./python2.7-minimal_2.7.18-8_arm64.deb + ;; + "amd64") + wget http://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8_amd64.deb + apt install ./libpython2.7-minimal_2.7.18-8_amd64.deb + wget http://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8_amd64.deb + apt install ./python2.7-minimal_2.7.18-8_amd64.deb + ;; + "armhf") + wget http://raspbian.raspberrypi.org/raspbian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-13.2_armhf.deb + apt install ./libpython2.7-minimal_2.7.18-13.2_armhf.deb + wget http://raspbian.raspberrypi.org/raspbian/pool/main/p/python2.7/python2.7-minimal_2.7.18-13.2_armhf.deb + apt install ./libpython2.7-minimal_2.7.18-13.2_armhf.deb + ;; +esac +rm *.deb +apt -y install virtualenv