2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 11:28:23 +00:00

updating venv generation

This commit is contained in:
Philip Sargent
2022-11-15 23:56:17 +00:00
parent 43bf2620f1
commit 96281c33e8
9 changed files with 58 additions and 93 deletions

View File

@@ -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'