summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorExpo laptop Crowley <cucc.expedition@gmail.com>2023-07-05 11:08:44 +0200
committerExpo laptop Crowley <cucc.expedition@gmail.com>2023-07-05 11:22:31 +0200
commitebcc0db6651efc3184f99a70c9ba1f67917d50ef (patch)
tree91f71cad91c2a3e1da4fb1679ab3ffd3daad42c1
parent73675ca1b90988e3c07602721ab77ba5c867786b (diff)
downloadtroggle-ebcc0db6651efc3184f99a70c9ba1f67917d50ef.tar.gz
troggle-ebcc0db6651efc3184f99a70c9ba1f67917d50ef.tar.bz2
troggle-ebcc0db6651efc3184f99a70c9ba1f67917d50ef.zip
ugh stage problem
-rwxr-xr-xrequirements-p9d4.txt19
-rwxr-xr-x[-rw-r--r--]requirements.txt0
-rwxr-xr-xvenv-trog-crowley.sh174
3 files changed, 193 insertions, 0 deletions
diff --git a/requirements-p9d4.txt b/requirements-p9d4.txt
new file mode 100755
index 0000000..85f60c1
--- /dev/null
+++ b/requirements-p9d4.txt
@@ -0,0 +1,19 @@
+asgiref==3.6.0
+black==23.1.0
+click==8.1.3
+coverage==7.1.0
+Django==4.2
+docutils==0.19
+isort==5.12.0
+mypy-extensions==1.0.0
+packaging==23.0
+pathspec==0.11.0
+Pillow==9.4.0
+pkg_resources==0.0.0
+platformdirs==3.0.0
+pytz==2022.7
+ruff==0.0.245
+sqlparse==0.4.3
+tomli==2.0.1
+typing_extensions==4.7.1
+Unidecode==1.3.6
diff --git a/requirements.txt b/requirements.txt
index c822f94..c822f94 100644..100755
--- a/requirements.txt
+++ b/requirements.txt
diff --git a/venv-trog-crowley.sh b/venv-trog-crowley.sh
new file mode 100755
index 0000000..378d002
--- /dev/null
+++ b/venv-trog-crowley.sh
@@ -0,0 +1,174 @@
+#!/bin/bash
+# Crowley has python 3.9.2
+# Taken from: 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-crowley.sh'
+echo '-- DONT RUN THIS - messes up permissions!'
+
+
+echo '-- Run this in a terminal in the real troggle directory: "bash venv-trog-crowley.sh"'
+# use the script os-trog-crowley.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.9
+VENAME=p9d4 # python3.x and django 4
+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 [ -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
+
+# 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}"
+source bin/activate
+echo "### Activated."
+ # 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
+
+# fudge for philip's machine
+if [ -d ${TROGDIR}/../expofiles ]; then
+ ln -s ${TROGDIR}/../expofiles expofiles
+else
+ if [ ! -d /mnt/f/expofiles ]; then
+ sudo mkdir /mnt/f
+ sudo mount -t drvfs F: /mnt/f
+ else
+ ln -s /mnt/f/expofiles expofiles
+ fi
+fi
+
+echo "### Setting file permissions.. may take a while.."
+git config --global --add safe.directory '*'
+sudo chmod -R 0777 *
+
+echo "### links to expoweb, troggle etc. complete:"
+ls -tla
+
+echo "###"
+echo "### now installing ${TROGDIR}/requirements.txt"
+echo "###"
+
+# 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
+
+$PIP install -r ${TROGDIR}/requirements.txt
+echo '### install from requirements.txt completed.'
+echo '### '
+
+$PIP freeze > requirements.txt
+# 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 requirements.txt >2
+comm -3 1 2 --check-order | awk '{ print $1}'>fresh-requirements.txt
+rm 1
+rm 2
+
+cp requirements.txt requirements-$VENAME.txt
+cp requirements-$VENAME.txt troggle/requirements-$VENAME.txt
+
+$PIP list > installed-pip.list
+$PIP list -o > installed-pip-o.list
+
+REQ=installation-record
+mkdir $REQ
+mv requirements-$VENAME.txt $REQ
+mv original.txt $REQ
+mv requirements.txt $REQ
+mv original-pip.list $REQ
+mv installed-pip.list $REQ
+mv installed-pip-o.list $REQ
+cp fresh-requirements.txt ../requirements.txt
+mv fresh-requirements.txt $REQ
+cp troggle/`basename "$0"` $REQ
+
+exit 1
+$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
+# Ran 85 tests in 83.492s
+# FAILED (failures=5)
+## 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/f/expofiles ]; then
+echo '### No valid expofiles directory. Fix this before any tests will work.
+fi