diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-03-02 23:18:39 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-03-02 23:18:39 +0000 |
commit | 73b26ec2063f1f3d8db26328c109a861a812af75 (patch) | |
tree | 6de93117465612d72434c2a0e7b7ce9cc7dce0ef /venv-trog.sh | |
parent | 601fc2cffc9f22187762c5ac362ee095c5d71dde (diff) | |
download | troggle-73b26ec2063f1f3d8db26328c109a861a812af75.tar.gz troggle-73b26ec2063f1f3d8db26328c109a861a812af75.tar.bz2 troggle-73b26ec2063f1f3d8db26328c109a861a812af75.zip |
uses venv & links script
Diffstat (limited to 'venv-trog.sh')
-rw-r--r-- | venv-trog.sh | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/venv-trog.sh b/venv-trog.sh new file mode 100644 index 0000000..0c88ba9 --- /dev/null +++ b/venv-trog.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# Run this in a terminal in the troggle directory: 'bash venv-trog.sh' + +# Expects an Ubuntu 20.04 relatively clean install. +# Running using SQLite 3.31.1 2020-01-27 19:55:54 + +# If you have not already installed these on your clean Ubuntu install DO THIS FIRST +# /usr/bin/python : ensure python is an alias for python3 not python2.7 +# sudo apt install sqlite3 +# sudo apt install python3-pip +# sudo apt install python3.9 + +# copy this file and requirements.txt into the directory above where you want to install the VENV +VENAME=p39 # python3.9 and django 2.22.25 + +if [ -d requirements.txt ]; then + echo "No requirements.txt found. Copy it here from your most recent installation." + exit 1 +fi + +cd .. +if [ ! -d $VENAME ]; then + echo "### Creating venv $VENAME" + python3.9 -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 +source bin/activate +PIP=bin/pip + +$PIP list > original-pip.list +$PIP freeze >original.txt + +ln -s ../expoweb expoweb +ln -s ../troggle troggle +ln -s ../loser loser +ln -s ../drawings drawings +ln -s /mnt/f/expofiles expofiles +ln -s ../expowebcache expowebcache + + # Package Version + # ------------- ---------- +echo '### links to expoweb, troggle etc. complete' +echo '###' +echo '### now installing requirements.txt' +echo '###' + +$PIP install -r troggle/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 virtualenv 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 + +python --version +echo "Django version:" +django-admin --version +echo "### Now do + 'cd ../$VENAME' + 'source bin/activate' + 'cd troggle' + 'python manage.py test -v 3' "
\ No newline at end of file |