diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2024-12-15 21:59:41 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2024-12-15 21:59:41 +0000 |
commit | a836dd261951ff3c5d9641d8b7306d6df9660bf1 (patch) | |
tree | ed841dde3b94b96d3fc0b36b292e274fd5018019 /_deploy/wsl | |
parent | b541e258ecebf1314a7b4264e86eecde9b82f30d (diff) | |
download | troggle-a836dd261951ff3c5d9641d8b7306d6df9660bf1.tar.gz troggle-a836dd261951ff3c5d9641d8b7306d6df9660bf1.tar.bz2 troggle-a836dd261951ff3c5d9641d8b7306d6df9660bf1.zip |
archiving the pip venv mechanisms
Diffstat (limited to '_deploy/wsl')
-rw-r--r-- | _deploy/wsl/using-pip/requirements-Dj3.2Bullseye.txt (renamed from _deploy/wsl/requirements-Dj3.2Bullseye.txt) | 0 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements-devupgrade.txt (renamed from _deploy/wsl/requirements-devupgrade.txt) | 0 | ||||
-rwxr-xr-x | _deploy/wsl/using-pip/requirements-keep.txt | 44 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements-p10d4.txt (renamed from _deploy/wsl/requirements-p10d4.txt) | 0 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements-p10d5.txt (renamed from _deploy/wsl/requirements-p10d5.txt) | 0 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements-p11d32.txt | 3 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements-p11d42.txt (renamed from _deploy/wsl/requirements-p11d42.txt) | 2 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements-p11d5.txt (renamed from _deploy/wsl/requirements-p11d5.txt) | 0 | ||||
-rwxr-xr-x | _deploy/wsl/using-pip/requirements-p12d5.txt | 20 | ||||
-rwxr-xr-x | _deploy/wsl/using-pip/requirements-p9d4.txt (renamed from _deploy/wsl/requirements-p9d4.txt) | 0 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/requirements3.2.txt (renamed from _deploy/wsl/requirements3.2.txt) | 0 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/venv-trog-d3.sh | 184 | ||||
-rw-r--r-- | _deploy/wsl/using-pip/venv-trog-d4.sh (renamed from _deploy/wsl/venv-trog-d4.sh) | 366 | ||||
-rwxr-xr-x | _deploy/wsl/using-pip/venv-trog-d5.sh (renamed from _deploy/wsl/venv-trog-d5.sh) | 48 |
14 files changed, 462 insertions, 205 deletions
diff --git a/_deploy/wsl/requirements-Dj3.2Bullseye.txt b/_deploy/wsl/using-pip/requirements-Dj3.2Bullseye.txt index 6b515f7..6b515f7 100644 --- a/_deploy/wsl/requirements-Dj3.2Bullseye.txt +++ b/_deploy/wsl/using-pip/requirements-Dj3.2Bullseye.txt diff --git a/_deploy/wsl/requirements-devupgrade.txt b/_deploy/wsl/using-pip/requirements-devupgrade.txt index 19fe6d8..19fe6d8 100644 --- a/_deploy/wsl/requirements-devupgrade.txt +++ b/_deploy/wsl/using-pip/requirements-devupgrade.txt diff --git a/_deploy/wsl/using-pip/requirements-keep.txt b/_deploy/wsl/using-pip/requirements-keep.txt new file mode 100755 index 0000000..a497cf9 --- /dev/null +++ b/_deploy/wsl/using-pip/requirements-keep.txt @@ -0,0 +1,44 @@ +For debian bullseye (10) +python3-django (3.2.12) +tinymce (from where?) +mariadb-server +apache2 +libapache2-mod-wsgi-py3 + + +python3-django-registration ? +Django==1.7 +django-extensions==2.2.9 +django-registration==2.0 +django-tinymce==2.0.1 +six==1.14.0 +Unidecode==1.1.1 python3-unidecode +Pillow==7.1.2 python3-willow + +asgiref==3.7.2 +attrs==22.2.0 +beautifulsoup4==4.12.2 +black==23.11.0 +bs4==0.0.1 +click==8.1.3 +colorama==0.4.6 +coverage==6.5.0 +Django==5.0 +docutils==0.20 +interrogate==1.5.0 +isort==5.11.4 +mypy-extensions==0.4.3 +packaging==23.2 +pathspec==0.10.3 +piexif==1.1.3 +Pillow==10.1.0 +platformdirs==2.6.2 +py==1.11.0 +pytz==2022.6 +ruff==0.1.0 +soupsieve==2.5 +sqlparse==0.4.0 +tabulate==0.9.0 +toml==0.10.2 +typing_extensions==4.4.0 +Unidecode==1.3.6 diff --git a/_deploy/wsl/requirements-p10d4.txt b/_deploy/wsl/using-pip/requirements-p10d4.txt index aafb7f6..aafb7f6 100644 --- a/_deploy/wsl/requirements-p10d4.txt +++ b/_deploy/wsl/using-pip/requirements-p10d4.txt diff --git a/_deploy/wsl/requirements-p10d5.txt b/_deploy/wsl/using-pip/requirements-p10d5.txt index 604ffcd..604ffcd 100644 --- a/_deploy/wsl/requirements-p10d5.txt +++ b/_deploy/wsl/using-pip/requirements-p10d5.txt diff --git a/_deploy/wsl/using-pip/requirements-p11d32.txt b/_deploy/wsl/using-pip/requirements-p11d32.txt new file mode 100644 index 0000000..987f2ed --- /dev/null +++ b/_deploy/wsl/using-pip/requirements-p11d32.txt @@ -0,0 +1,3 @@ +asgiref==3.8.1 +Django==5.1b1 +sqlparse==0.5.1 diff --git a/_deploy/wsl/requirements-p11d42.txt b/_deploy/wsl/using-pip/requirements-p11d42.txt index 7d1992c..aa64d29 100644 --- a/_deploy/wsl/requirements-p11d42.txt +++ b/_deploy/wsl/using-pip/requirements-p11d42.txt @@ -11,6 +11,7 @@ isort==5.12.0 mypy-extensions==1.0.0 packaging==23.0 pathspec==0.11.0 +piexif==1.1.3 Pillow==9.4.0 platformdirs==3.0.0 pytz==2022.7 @@ -18,4 +19,3 @@ ruff==0.0.245 soupsieve==2.5 sqlparse==0.4.0 Unidecode==1.3.0 -piexif diff --git a/_deploy/wsl/requirements-p11d5.txt b/_deploy/wsl/using-pip/requirements-p11d5.txt index ee1d50c..ee1d50c 100644 --- a/_deploy/wsl/requirements-p11d5.txt +++ b/_deploy/wsl/using-pip/requirements-p11d5.txt diff --git a/_deploy/wsl/using-pip/requirements-p12d5.txt b/_deploy/wsl/using-pip/requirements-p12d5.txt new file mode 100755 index 0000000..4b76edb --- /dev/null +++ b/_deploy/wsl/using-pip/requirements-p12d5.txt @@ -0,0 +1,20 @@ +Pillow==10.2 +Unidecode==1.3.8 +asgiref==3.6 +beautifulsoup4==4.12 +black==24.2 +chardet==5.2 +click==8.1 +coverage==7 +deptry==0.12.0 +docutils==0.20 +isort==5 +mypy-extensions==1.0 +packaging==23 +pathspec==0.12 +platformdirs==4 +pytz==2024.1 +ruff==0.2 +soupsieve==2.5 +sqlparse +piexif diff --git a/_deploy/wsl/requirements-p9d4.txt b/_deploy/wsl/using-pip/requirements-p9d4.txt index 5e290b5..5e290b5 100755 --- a/_deploy/wsl/requirements-p9d4.txt +++ b/_deploy/wsl/using-pip/requirements-p9d4.txt diff --git a/_deploy/wsl/requirements3.2.txt b/_deploy/wsl/using-pip/requirements3.2.txt index 47beb3d..47beb3d 100644 --- a/_deploy/wsl/requirements3.2.txt +++ b/_deploy/wsl/using-pip/requirements3.2.txt diff --git a/_deploy/wsl/using-pip/venv-trog-d3.sh b/_deploy/wsl/using-pip/venv-trog-d3.sh new file mode 100644 index 0000000..ede077e --- /dev/null +++ b/_deploy/wsl/using-pip/venv-trog-d3.sh @@ -0,0 +1,184 @@ +#!/bin/bash +# 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 real troggle directory: "bash venv-trog.sh"' + +# Expects an Ubuntu 22.04 (or 20.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.11 + +# NOW we set up troggle +PYTHON=python3.11 +VENAME=p11d32 # python3.x and django 4.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/" +TROGDIR=$(cd $(dirname $0) && pwd) +echo "-- Troggle folder (this script location): ${TROGDIR}" + +REQUIRE=requirements-$VENAME.txt + +if [ -d $REQUIRE ]; then + echo "-- No ${REQUIRE} found. You should be in the /troggle/ folder. Copy it from your most recent installation." + exit 1 +fi +echo ## Using $REQUIRE : +cat $REQUIRE +echo ## + + +$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 +echo Creating links from Linux filesystem user +# These links only need making once, for many venv +cd ~ + +if [ ! -d $VENAME ]; then + 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 +fi + + # Activate the virtual env and see what the default packages are +echo "### Activating $VENAME" + +cd $VENAME +echo "-- now in: ${PWD}" +ls -tlarg +source bin/activate +echo $VIRTUAL_ENV +if [ -d ~/$VENAME/bin ]; then + echo "### Activating." +else + echo "## ~/$VENAME/bin does not exist. FAILed to create venv properly." + exit 1 +fi + # update local version of pip, more recent than OS version + # debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3 + + # 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 + +PIP=pip + +$PIP list > original-pip.list +$PIP freeze >original.txt + +# we are in /home/$USER/$VENAME/ +ln -s ${TROGDIR} troggle +ln -s ${TROGDIR}/../expoweb expoweb +ln -s ${TROGDIR}/../loser loser +ln -s ${TROGDIR}/../drawings drawings +#ln -s ${TROGDIR}/../expofiles expofiles + +# fudge for philip's machine +if [ ! -d /mnt/d/EXPO ]; then + sudo mkdir /mnt/d + sudo mount -t drvfs D: /mnt/d +fi + +if [ -d ${TROGDIR}/../expofiles ]; then + ln -s ${TROGDIR}/../expofiles expofiles +else + ln -s /mnt/d/EXPO/expofiles expofiles +fi + +echo "### Setting file permissions.. may take a while.." +git config --global --add safe.directory '*' +sudo chmod -R 777 * + +echo "### links to expoweb, troggle etc. complete:" +ls -tla +echo "###" +echo "### now installing ${TROGDIR}/${REQUIRE}" +echo "###" +cat ${TROGDIR}/${REQUIRE} + +# NOW THERE IS A PERMISSIONS FAILURE THAT DIDN'T HAPPEN BEFORE +# seen on wsl2 as well as wsl1 +# which ALSO ruins EXISTING permissions ! +# Guessing it is to do with pip not liking non-standard py 3.11 installation on Ubuntu 22.04 + +read -p "Press any key to resume ..." +$PIP install -r ${TROGDIR}/${REQUIRE} +echo "### install from ${TROGDIR}/${REQUIRE} completed." +echo '### ' + +$PIP install --pre django + +$PIP freeze > $REQUIRE +# so that we can track requirements more easily with git +# because we do not install these with pip, but they are listed by the freeze command +# Now find out what we actually installed by subtracting the stuff venv installed anyway +sort original.txt > 1 +sort $REQUIRE >2 +comm -3 1 2 --check-order | awk '{ print $1}'>fresh-$REQUIRE +rm 1 +rm 2 + +# cp $REQUIRE requirements-$VENAME.txt +cp $REQUIRE troggle/$REQUIRE + +$PIP list > installed-pip.list +$PIP list -o > installed-pip-o.list + +REQ=installation-record +mkdir $REQ + +mv original.txt $REQ +mv $REQUIRE $REQ +mv original-pip.list $REQ +mv installed-pip.list $REQ +mv installed-pip-o.list $REQ +cp fresh-$REQUIRE ../$REQUIRE +mv fresh-$REQUIRE $REQ +cp troggle/`basename "$0"` $REQ + + +$PYTHON --version +python --version +echo "Django version:`django-admin --version`" + +echo "### Now do + '[sudo service mysql start]' + '[sudo service mariadb restart]' + '[sudo mysql_secure_installation]' + 'cd ~/$VENAME' + 'source bin/activate' + 'cd troggle' + 'django-admin' + 'python manage.py check' +## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html +## you need to follow the Linux instructions. + 'ssh expo@expo.survex.com' + +## the next tests will fail unless ~/expofiles is set correctly to a folder on your machine +## the tests may ALSO fail because of ssh and permissions errors + +## So you will need to run +$sudo chown -Rhv philip:philip ~/$VENAME (if your username is philip) +# and then REBOOT (or at least, exit WSL and terminate and restart WSL) +# because this chmod only takes effect then. + + 'python manage.py test -v 2' + './pre-run.sh' (runs the tests again) + + 'python databaseReset.py reset $VENAME' + 'python manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)' + " +# if [ ! -d /mnt/d/expofiles ]; then + # echo '### No valid expofiles directory on /mnt/d . Fix this before any tests will work.' +# fi
\ No newline at end of file diff --git a/_deploy/wsl/venv-trog-d4.sh b/_deploy/wsl/using-pip/venv-trog-d4.sh index 5390b06..97e99b7 100644 --- a/_deploy/wsl/venv-trog-d4.sh +++ b/_deploy/wsl/using-pip/venv-trog-d4.sh @@ -1,184 +1,184 @@ -#!/bin/bash
-# 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 real troggle directory: "bash venv-trog.sh"'
-
-# Expects an Ubuntu 22.04 with all the gubbins pre-installed
-# 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.11
-
-# NOW we set up troggle
-PYTHON=python3.11
-VENAME=p11d42 # python3.x and django 4.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/"
-TROGDIR=$(cd $(dirname $0) && pwd)
-echo "-- Troggle folder (this script location): ${TROGDIR}"
-
-REQUIRE=requirements-$VENAME.txt
-
-if [ -d $REQUIRE ]; then
- echo "-- No ${REQUIRE} found. You should be in the /troggle/ folder. Copy it from your most recent installation."
- exit 1
-fi
-echo ## Using $REQUIRE :
-cat $REQUIRE
-echo ##
-
-
-$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
-echo Creating links from Linux filesystem user
-# These links only need making once, for many venv
-cd ~
-
-if [ ! -d $VENAME ]; then
- 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
-fi
-
- # Activate the virtual env and see what the default packages are
-echo "### Activating $VENAME"
-
-cd $VENAME
-echo "-- now in: ${PWD}"
-ls -tlarg
-source bin/activate
-echo $VIRTUAL_ENV
-if [ -d ~/$VENAME/bin ]; then
- echo "### Activating."
-else
- echo "## ~/$VENAME/bin does not exist. FAILed to create venv properly."
- exit 1
-fi
- # update local version of pip, more recent than OS version
- # debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3
-
- # 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
-
-PIP=pip
-
-$PIP list > original-pip.list
-$PIP freeze >original.txt
-
-# we are in /home/$USER/$VENAME/
-ln -s ${TROGDIR} troggle
-ln -s ${TROGDIR}/../expoweb expoweb
-ln -s ${TROGDIR}/../loser loser
-ln -s ${TROGDIR}/../drawings drawings
-#ln -s ${TROGDIR}/../expofiles expofiles
-
-# fudge for philip's machine
-if [ ! -d /mnt/d/EXPO ]; then
- sudo mkdir /mnt/d
- sudo mount -t drvfs D: /mnt/d
-fi
-
-if [ -d ${TROGDIR}/../expofiles ]; then
- ln -s ${TROGDIR}/../expofiles expofiles
-else
- ln -s /mnt/d/EXPO/expofiles expofiles
-fi
-
-echo "### Setting file permissions.. may take a while.."
-git config --global --add safe.directory '*'
-sudo chmod -R 777 *
-
-echo "### links to expoweb, troggle etc. complete:"
-ls -tla
-echo "###"
-echo "### now installing ${TROGDIR}/${REQUIRE}"
-echo "###"
-cat ${TROGDIR}/${REQUIRE}
-
-# NOW THERE IS A PERMISSIONS FAILURE THAT DIDN'T HAPPEN BEFORE
-# seen on wsl2 as well as wsl1
-# which ALSO ruins EXISTING permissions !
-# Guessing it is to do with pip not liking non-standard py 3.11 installation on Ubuntu 22.04
-
-read -p "Press any key to resume ..."
-$PIP install -r ${TROGDIR}/${REQUIRE}
-echo "### install from ${TROGDIR}/${REQUIRE} completed."
-echo '### '
-
-$PIP install --pre django
-
-$PIP freeze > $REQUIRE
-# so that we can track requirements more easily with git
-# because we do not install these with pip, but they are listed by the freeze command
-# Now find out what we actually installed by subtracting the stuff venv installed anyway
-sort original.txt > 1
-sort $REQUIRE >2
-comm -3 1 2 --check-order | awk '{ print $1}'>fresh-$REQUIRE
-rm 1
-rm 2
-
-# cp $REQUIRE requirements-$VENAME.txt
-cp $REQUIRE troggle/$REQUIRE
-
-$PIP list > installed-pip.list
-$PIP list -o > installed-pip-o.list
-
-REQ=installation-record
-mkdir $REQ
-
-mv original.txt $REQ
-mv $REQUIRE $REQ
-mv original-pip.list $REQ
-mv installed-pip.list $REQ
-mv installed-pip-o.list $REQ
-cp fresh-$REQUIRE ../$REQUIRE
-mv fresh-$REQUIRE $REQ
-cp troggle/`basename "$0"` $REQ
-
-
-$PYTHON --version
-python --version
-echo "Django version:`django-admin --version`"
-
-echo "### Now do
- '[sudo service mysql start]'
- '[sudo service mariadb restart]'
- '[sudo mysql_secure_installation]'
- 'cd ~/$VENAME'
- 'source bin/activate'
- 'cd troggle'
- 'django-admin'
- 'python manage.py check'
-## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html
-## you need to follow the Linux instructions.
- 'ssh expo@expo.survex.com'
-
-## the next tests will fail unless ~/expofiles is set correctly to a folder on your machine
-## the tests may ALSO fail because of ssh and permissions errors
-
-## So you will need to run
-$sudo chown -Rhv philip:philip ~/$VENAME (if your username is philip)
-# and then REBOOT (or at least, exit WSL and terminate and restart WSL)
-# because this chmod only takes effect then.
-
- 'python manage.py test -v 2'
- './pre-run.sh' (runs the tests again)
-
- 'python databaseReset.py reset $VENAME'
- 'python manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)'
- "
-# if [ ! -d /mnt/d/expofiles ]; then
- # echo '### No valid expofiles directory on /mnt/d . Fix this before any tests will work.'
+#!/bin/bash +# 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 real troggle directory: "bash venv-trog.sh"' + +# Expects an Ubuntu 22.04 (or 20.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.11 + +# NOW we set up troggle +PYTHON=python3.11 +VENAME=p11d42 # python3.x and django 4.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/" +TROGDIR=$(cd $(dirname $0) && pwd) +echo "-- Troggle folder (this script location): ${TROGDIR}" + +REQUIRE=requirements-$VENAME.txt + +if [ -d $REQUIRE ]; then + echo "-- No ${REQUIRE} found. You should be in the /troggle/ folder. Copy it from your most recent installation." + exit 1 +fi +echo ## Using $REQUIRE : +cat $REQUIRE +echo ## + + +$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 +echo Creating links from Linux filesystem user +# These links only need making once, for many venv +cd ~ + +if [ ! -d $VENAME ]; then + 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 +fi + + # Activate the virtual env and see what the default packages are +echo "### Activating $VENAME" + +cd $VENAME +echo "-- now in: ${PWD}" +ls -tlarg +source bin/activate +echo $VIRTUAL_ENV +if [ -d ~/$VENAME/bin ]; then + echo "### Activating." +else + echo "## ~/$VENAME/bin does not exist. FAILed to create venv properly." + exit 1 +fi + # update local version of pip, more recent than OS version + # debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3 + + # 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 + +PIP=pip + +$PIP list > original-pip.list +$PIP freeze >original.txt + +# we are in /home/$USER/$VENAME/ +ln -s ${TROGDIR} troggle +ln -s ${TROGDIR}/../expoweb expoweb +ln -s ${TROGDIR}/../loser loser +ln -s ${TROGDIR}/../drawings drawings +#ln -s ${TROGDIR}/../expofiles expofiles + +# fudge for philip's machine +if [ ! -d /mnt/d/EXPO ]; then + sudo mkdir /mnt/d + sudo mount -t drvfs D: /mnt/d +fi + +if [ -d ${TROGDIR}/../expofiles ]; then + ln -s ${TROGDIR}/../expofiles expofiles +else + ln -s /mnt/d/EXPO/expofiles expofiles +fi + +echo "### Setting file permissions.. may take a while.." +git config --global --add safe.directory '*' +sudo chmod -R 777 * + +echo "### links to expoweb, troggle etc. complete:" +ls -tla +echo "###" +echo "### now installing ${TROGDIR}/${REQUIRE}" +echo "###" +cat ${TROGDIR}/${REQUIRE} + +# NOW THERE IS A PERMISSIONS FAILURE THAT DIDN'T HAPPEN BEFORE +# seen on wsl2 as well as wsl1 +# which ALSO ruins EXISTING permissions ! +# Guessing it is to do with pip not liking non-standard py 3.11 installation on Ubuntu 22.04 + +read -p "Press any key to resume ..." +$PIP install -r ${TROGDIR}/${REQUIRE} +echo "### install from ${TROGDIR}/${REQUIRE} completed." +echo '### ' + +$PIP install --pre django + +$PIP freeze > $REQUIRE +# so that we can track requirements more easily with git +# because we do not install these with pip, but they are listed by the freeze command +# Now find out what we actually installed by subtracting the stuff venv installed anyway +sort original.txt > 1 +sort $REQUIRE >2 +comm -3 1 2 --check-order | awk '{ print $1}'>fresh-$REQUIRE +rm 1 +rm 2 + +# cp $REQUIRE requirements-$VENAME.txt +cp $REQUIRE troggle/$REQUIRE + +$PIP list > installed-pip.list +$PIP list -o > installed-pip-o.list + +REQ=installation-record +mkdir $REQ + +mv original.txt $REQ +mv $REQUIRE $REQ +mv original-pip.list $REQ +mv installed-pip.list $REQ +mv installed-pip-o.list $REQ +cp fresh-$REQUIRE ../$REQUIRE +mv fresh-$REQUIRE $REQ +cp troggle/`basename "$0"` $REQ + + +$PYTHON --version +python --version +echo "Django version:`django-admin --version`" + +echo "### Now do + '[sudo service mysql start]' + '[sudo service mariadb restart]' + '[sudo mysql_secure_installation]' + 'cd ~/$VENAME' + 'source bin/activate' + 'cd troggle' + 'django-admin' + 'python manage.py check' +## this tests if you have set up ssh correcting. Refer to documentation https://expo.survex.com/handbook/computing/keyexchange.html +## you need to follow the Linux instructions. + 'ssh expo@expo.survex.com' + +## the next tests will fail unless ~/expofiles is set correctly to a folder on your machine +## the tests may ALSO fail because of ssh and permissions errors + +## So you will need to run +$sudo chown -Rhv philip:philip ~/$VENAME (if your username is philip) +# and then REBOOT (or at least, exit WSL and terminate and restart WSL) +# because this chmod only takes effect then. + + 'python manage.py test -v 2' + './pre-run.sh' (runs the tests again) + + 'python databaseReset.py reset $VENAME' + 'python manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)' + " +# if [ ! -d /mnt/d/expofiles ]; then + # echo '### No valid expofiles directory on /mnt/d . Fix this before any tests will work.' # fi
\ No newline at end of file diff --git a/_deploy/wsl/venv-trog-d5.sh b/_deploy/wsl/using-pip/venv-trog-d5.sh index 6ec82a0..68d9424 100755 --- a/_deploy/wsl/venv-trog-d5.sh +++ b/_deploy/wsl/using-pip/venv-trog-d5.sh @@ -8,17 +8,23 @@ echo '-- Run this in a terminal in the real troggle directory: "bash venv-trog.s # 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.11 +# If you are using Ubuntu, then it is easy to use a later version of python, e.g. 3.12 # NOW we set up troggle -PYTHON=python3.11 -VENAME=p11d5 # python3.x and django 4.2 +PYTHON=python3.12 +VENAME=p12d5 # python3.x and django version 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/" TROGDIR=$(cd $(dirname $0) && pwd) echo "-- Troggle folder (this script location): ${TROGDIR}" +if [[ "${VENAME:(-1)}" == 5 ]]; then + echo "The variable '$VENAME' ends in 5." +else + echo "The variable '$VENAME' does not end in 5." +fi + REQUIRE=requirements-$VENAME.txt if [ -d $REQUIRE ]; then @@ -42,7 +48,7 @@ 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 ensure you have python3.11-venv installed and/or use a Ubuntu window)" + echo "## Creating venv $VENAME. (If this fails with a pip error, you need to ensure you have python3.12-venv installed and/or use a Ubuntu window)" $PYTHON -m venv $VENAME else echo "## /$VENAME/ already exists ! Delete it first." @@ -72,10 +78,8 @@ echo "### installing later version of pip inside $VENAME" $PYTHON -m pip install --upgrade pip $PYTHON -m pip install --upgrade setuptools -PIP=pip - -$PIP list > original-pip.list -$PIP freeze >original.txt +$PYTHON -m pip list > original-pip.list +$PYTHON -m pip freeze >original.txt # we are in /home/$USER/$VENAME/ ln -s ${TROGDIR} troggle @@ -106,25 +110,25 @@ echo "###" echo "### now installing ${TROGDIR}/${REQUIRE}" echo "###" cat ${TROGDIR}/${REQUIRE} - -# NOW THERE IS A PERMISSIONS FAILURE THAT DIDN'T HAPPEN BEFORE -# seen on wsl2 as well as wsl1 -# which ALSO ruins EXISTING permissions ! -# Guessing it is to do with pip not liking non-standard py 3.11 installation on Ubuntu 22.04 +cp -f ${TROGDIR}/${REQUIRE} ${TROGDIR}/${REQUIRE}.orig read -p "Press any key to resume ..." -$PIP install -r ${TROGDIR}/${REQUIRE} +$PYTHON -m pip install -r ${TROGDIR}/${REQUIRE} echo "### install from ${TROGDIR}/${REQUIRE} completed." echo '### ' -$PIP install --pre django +# this installs pre-release django 5.0 +if [[ "${VENAME:(-1)}" == 5 ]]; then + echo "### Installing pre-release version of Django" + $PYTHON -m pip install --pre django +fi -$PIP freeze > $REQUIRE +$PYTHON -m pip freeze > $REQUIRE.freeze # so that we can track requirements more easily with git # because we do not install these with pip, but they are listed by the freeze command # Now find out what we actually installed by subtracting the stuff venv installed anyway sort original.txt > 1 -sort $REQUIRE >2 +sort $REQUIRE.freeze >2 comm -3 1 2 --check-order | awk '{ print $1}'>fresh-$REQUIRE rm 1 rm 2 @@ -132,22 +136,24 @@ rm 2 # cp $REQUIRE requirements-$VENAME.txt cp $REQUIRE troggle/$REQUIRE -$PIP list > installed-pip.list -$PIP list -o > installed-pip-o.list +$PYTHON -m pip list > installed-pip.list +$PYTHON -m pip list -o > installed-pip-o.list REQ=installation-record mkdir $REQ +mv $REQUIRE.freeze $REQ mv original.txt $REQ mv $REQUIRE $REQ mv original-pip.list $REQ mv installed-pip.list $REQ mv installed-pip-o.list $REQ -cp fresh-$REQUIRE ../$REQUIRE +# cp fresh-$REQUIRE ../$REQUIRE mv fresh-$REQUIRE $REQ cp troggle/`basename "$0"` $REQ + $PYTHON --version python --version echo "Django version:`django-admin --version`" @@ -181,4 +187,4 @@ $sudo chown -Rhv philip:philip ~/$VENAME (if your username is philip) " # if [ ! -d /mnt/d/expofiles ]; then # echo '### No valid expofiles directory on /mnt/d . Fix this before any tests will work.' -# fi
\ No newline at end of file +# fi |