From 96281c33e89195b0120ba5c4ad8828f0ba1c2b4e Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 15 Nov 2022 23:56:17 +0000 Subject: [PATCH] updating venv generation --- os-trog.sh | 8 +++---- requirements-d22p39.txt | 10 --------- requirements-p10d5.txt | 20 +++++++----------- requirements-p11d5.txt | 9 ++++++++ requirements-p3.10.txt | 15 ------------- requirements-p3.10d3.5.txt | 15 ------------- requirements-p310.txt | 12 ----------- requirements.txt | 19 ++++++----------- venv-trog.sh | 43 ++++++++++++++++++++++++++++---------- 9 files changed, 58 insertions(+), 93 deletions(-) delete mode 100644 requirements-d22p39.txt create mode 100644 requirements-p11d5.txt delete mode 100644 requirements-p3.10.txt delete mode 100644 requirements-p3.10d3.5.txt delete mode 100644 requirements-p310.txt diff --git a/os-trog.sh b/os-trog.sh index 1afa0a0..ed86d94 100644 --- a/os-trog.sh +++ b/os-trog.sh @@ -36,10 +36,10 @@ sudo apt install git openssh-client tunnelx therion -y sudo useradd expo sudo usermod -a -G sudo expo # to put expo in sudoers group, re-login required # default since 22.04 -# sudo apt install python3.10 -sudo apt install python3.10-venv -y -sudo apt install python3.10-dev -y -sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 +# sudo apt install python3.11 +sudo apt install python3.11-venv -y +sudo apt install python3.11-dev -y +sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 sudo apt install mariadb-server -y sudo apt install libmariadb-dev -y diff --git a/requirements-d22p39.txt b/requirements-d22p39.txt deleted file mode 100644 index e160b2d..0000000 --- a/requirements-d22p39.txt +++ /dev/null @@ -1,10 +0,0 @@ -asgiref==3.3.4 -confusable-homoglyphs==3.2.0 -coverage==5.5 -Django==2.2.25 -docutils==0.14 -gunicorn==20.1.0 -pytz==2019.1 -sqlparse==0.2.4 -typing-extensions==3.7.4.3 -Unidecode==1.0.23 diff --git a/requirements-p10d5.txt b/requirements-p10d5.txt index eef9532..604ffcd 100644 --- a/requirements-p10d5.txt +++ b/requirements-p10d5.txt @@ -1,15 +1,9 @@ asgiref==3.5.2 -confusable-homoglyphs==3.2.0 -coverage==6.4 -Django==3.2 -docutils==0.18 -mariadb==1.0.11 -mysql-connector-python==8.0.29 -mysqlclient==2.1.0 -Pillow==9.2.0 -protobuf==4.21.2 -pytz==2022.5 -reportlab==3.6.0 -sqlparse==0.4.0 -typing_extensions==4.2.0 +coverage==6.5.0 +Django==3.2.16 +docutils==0.19 +Pillow==9.3.0 +pytz==2022.6 +sqlparse==0.4.3 +typing_extensions==4.4.0 Unidecode==1.3.6 diff --git a/requirements-p11d5.txt b/requirements-p11d5.txt new file mode 100644 index 0000000..604ffcd --- /dev/null +++ b/requirements-p11d5.txt @@ -0,0 +1,9 @@ +asgiref==3.5.2 +coverage==6.5.0 +Django==3.2.16 +docutils==0.19 +Pillow==9.3.0 +pytz==2022.6 +sqlparse==0.4.3 +typing_extensions==4.4.0 +Unidecode==1.3.6 diff --git a/requirements-p3.10.txt b/requirements-p3.10.txt deleted file mode 100644 index eef9532..0000000 --- a/requirements-p3.10.txt +++ /dev/null @@ -1,15 +0,0 @@ -asgiref==3.5.2 -confusable-homoglyphs==3.2.0 -coverage==6.4 -Django==3.2 -docutils==0.18 -mariadb==1.0.11 -mysql-connector-python==8.0.29 -mysqlclient==2.1.0 -Pillow==9.2.0 -protobuf==4.21.2 -pytz==2022.5 -reportlab==3.6.0 -sqlparse==0.4.0 -typing_extensions==4.2.0 -Unidecode==1.3.6 diff --git a/requirements-p3.10d3.5.txt b/requirements-p3.10d3.5.txt deleted file mode 100644 index eef9532..0000000 --- a/requirements-p3.10d3.5.txt +++ /dev/null @@ -1,15 +0,0 @@ -asgiref==3.5.2 -confusable-homoglyphs==3.2.0 -coverage==6.4 -Django==3.2 -docutils==0.18 -mariadb==1.0.11 -mysql-connector-python==8.0.29 -mysqlclient==2.1.0 -Pillow==9.2.0 -protobuf==4.21.2 -pytz==2022.5 -reportlab==3.6.0 -sqlparse==0.4.0 -typing_extensions==4.2.0 -Unidecode==1.3.6 diff --git a/requirements-p310.txt b/requirements-p310.txt deleted file mode 100644 index ff5b804..0000000 --- a/requirements-p310.txt +++ /dev/null @@ -1,12 +0,0 @@ -asgiref==3.3.4 -confusable-homoglyphs==3.2.0 -coverage==5.5 -Django==3.2 -docutils==0.14 -gunicorn==20.1.0 -Pillow==9.0.1 -pytz==2019.1 -reportlab==3.6.8 -sqlparse==0.2.4 -typing-extensions==3.7.4.3 -Unidecode==1.0.23 diff --git a/requirements.txt b/requirements.txt index eef9532..e9df9fd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,8 @@ asgiref==3.5.2 -confusable-homoglyphs==3.2.0 -coverage==6.4 -Django==3.2 -docutils==0.18 -mariadb==1.0.11 -mysql-connector-python==8.0.29 -mysqlclient==2.1.0 -Pillow==9.2.0 -protobuf==4.21.2 -pytz==2022.5 -reportlab==3.6.0 -sqlparse==0.4.0 -typing_extensions==4.2.0 +coverage==6.5 +Django==3.2.16 +docutils==0.19 +pytz==2022.6 +typing_extensions==4.4.0 Unidecode==1.3.6 +Pillow==9.3 diff --git a/venv-trog.sh b/venv-trog.sh index 02d5865..188b751 100644 --- a/venv-trog.sh +++ b/venv-trog.sh @@ -1,14 +1,19 @@ #!/bin/bash -# footled lots to make this work with python 3.10 and WSL1 on Ubuntu 22.04 +# footled lots to make this work with python 3.10 & 3.11 and WSL1 and WSL2 on Ubuntu 22.04 # Run this in a terminal in the troggle directory: 'bash venv-trog.sh' -echo '-- Run this in a terminal in the troggle directory: "bash venv-trog.sh"' +echo '-- Run this in a terminal in the real troggle directory: "bash venv-trog.sh"' # Expects an Ubuntu 22.04 relatively clean install. # If you have not already installed these on your clean Ubuntu install DO THIS FIRST # use the script os-trog.sh +# If you are using Debian, then stick with the default version of python +# If you are using Ubuntu, then it is easy to use a later version of python, e.g. 3.10 or 3.11 + + # NOW we set up troggle -VENAME=p10d5 # python3.10 and django 3.2 +PYTHON=python3.10 +VENAME=p10d5 # python3.x and django 3.2 echo "** You are logged in as `id -u -n`" echo "The 50MB pip cache will be in /home/`id -u -n`/.cache/" echo "The 150MB venv will created in /home/`id -u -n`/$VENAME/" @@ -19,8 +24,15 @@ if [ -d requirements.txt ]; then echo "-- No requirements.txt found. Copy it from your most recent installation." exit 1 fi +echo ## Using requirements.txt : +cat requirements.txt +echo ## -python --version + +$PYTHON --version + +# NOTE that when using a later or earlier verison of python, you MUST also +# use the allowed version of Pillow, see https://pillow.readthedocs.io/en/latest/installation.html # NOW set up link from expo user folder # needed for WSL2 @@ -29,8 +41,8 @@ echo Creating links from Linux filesystem user cd ~ if [ ! -d $VENAME ]; then - echo "## Creating venv $VENAME. (If this fails with a pip error, you need to use a Ubuntu window)" - python -m venv $VENAME + echo "## Creating venv $VENAME. (If this fails with a pip error, you need to ensure you have python3.11-venv installed and/or use a Ubuntu window)" + $PYTHON -m venv $VENAME else echo "## /$VENAME/ already exists ! Delete it first." exit 1 @@ -49,8 +61,8 @@ echo "### Activated." # update local version of setuptools, more recent than OS version, needed for packages without wheels echo "### installing later version of pip inside $VENAME" -python -m pip install --upgrade pip -python -m pip install --upgrade setuptools +$PYTHON -m pip install --upgrade pip +$PYTHON -m pip install --upgrade setuptools PIP=pip @@ -62,9 +74,17 @@ ln -s ${TROGDIR} troggle ln -s ${TROGDIR}/../expoweb expoweb ln -s ${TROGDIR}/../loser loser ln -s ${TROGDIR}/../drawings drawings -ln -s ${TROGDIR}/../expofiles expofiles -echo "### links to expoweb, troggle etc. complete" +# fudge for philip's machine +if [ -d ${TROGDIR}/../expofiles ]; then + ln -s ${TROGDIR}/../expofiles expofiles +else + ln -s /mnt/f/expofiles expofiles +fi + + +echo "### links to expoweb, troggle etc. complete:" +ls -tla echo "###" echo "### now installing ${TROGDIR}/requirements.txt" echo "###" @@ -101,6 +121,7 @@ mv fresh-requirements.txt $REQ cp troggle/`basename "$0"` $REQ +$PYTHON --version python --version echo "Django version:`django-admin --version`" @@ -111,7 +132,7 @@ echo "### Now do 'cd ~/$VENAME' 'source bin/activate' 'cd troggle' - 'django-admin check' + 'django-admin' 'python manage.py check' 'python manage.py test -v 2' './pre-run.sh'