mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 11:28:23 +00:00
fixes for WSL1 on new machine
This commit is contained in:
76
venv-trog.sh
76
venv-trog.sh
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
# footled lots to make this work with python 3.10 and WSL1 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 troggle directory: "bash venv-trog.sh"'
|
||||
|
||||
# Expects an Ubuntu 22.04 relatively clean install.
|
||||
# Running using SQLite version 3.37.2 2022-01-06 13:25:41
|
||||
@@ -8,6 +9,7 @@ echo 'Run this in a terminal in the troggle directory: "bash venv-trog.sh"'
|
||||
|
||||
# If you have not already installed these on your clean Ubuntu install DO THIS FIRST
|
||||
# use the script os-trog.sh
|
||||
# which does the following:
|
||||
|
||||
# python --version : ensure python is an alias for python3 not python2.7
|
||||
# sudo apt install sqlite3
|
||||
@@ -31,55 +33,93 @@ echo 'Run this in a terminal in the troggle directory: "bash venv-trog.sh"'
|
||||
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
|
||||
#
|
||||
|
||||
# NOW we set up troggle
|
||||
# copy this file and requirements.txt into the directory above where you want to install the VENV
|
||||
VENAME=p10d3 # python3.10 and django 3.2
|
||||
VENAME=zp310d3 # python3.10 and django 3.2
|
||||
|
||||
echo "-- Script executed from: ${PWD}"
|
||||
TROGDIR=$(cd $(dirname $0) && pwd)
|
||||
sudo echo "-- Troggle folder (this script location): ${TROGDIR}"
|
||||
|
||||
if [ -d requirements.txt ]; then
|
||||
echo "No requirements.txt found. Copy it from your most recent installation."
|
||||
echo "-- No requirements.txt found. Copy it from your most recent installation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
python --version
|
||||
|
||||
# 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 ~
|
||||
# cd ..
|
||||
# mkdir expo
|
||||
# cd expo
|
||||
# ln -s ${TROGDIR}../$VENAME $VENAME
|
||||
if [ -d troggle ]; then
|
||||
echo "-- No /troggle/ found. Creating links."
|
||||
ln -s ${TROGDIR} troggle
|
||||
ln -s ${TROGDIR}/../expoweb expoweb
|
||||
ln -s ${TROGDIR}/../loser loser
|
||||
ln -s ${TROGDIR}/../drawings drawings
|
||||
ln -s ${TROGDIR}/../expofiles expofiles
|
||||
fi
|
||||
|
||||
|
||||
# LOOK HERE: we go up a level so that /$VENAME is parallel to /troggle
|
||||
cd ..
|
||||
#cd ..
|
||||
if [ ! -d $VENAME ]; then
|
||||
echo "### Creating venv $VENAME"
|
||||
echo "## Creating venv $VENAME. (If this fails with a pip error, you need to use a Ubuntu window)"
|
||||
python -m venv $VENAME
|
||||
else
|
||||
echo "/$VENAME/ already exists ! Delete it first."
|
||||
echo "## /$VENAME/ already exists ! Delete it first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# seems to create infinite loop for tests
|
||||
# echo "-- Make link from EXPO folder to venv $VENAME"
|
||||
# sudo ln -s $VENAME ${TROGDIR}/../$VENAME
|
||||
|
||||
# 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
|
||||
|
||||
#This fails when using python3.10 (which has installed pip 22.0.2) and is attempting to upgrade to 22.3
|
||||
# WARNING: No metadata found in ./lib/python3.10/site-packages
|
||||
# and then the rollback fails to roll back successfully.
|
||||
|
||||
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
|
||||
|
||||
ln -s ../expoweb expoweb
|
||||
ln -s ../troggle troggle
|
||||
ln -s ../loser loser
|
||||
ln -s ../drawings drawings
|
||||
ln -s ../expofiles expofiles
|
||||
|
||||
ln -s ${TROGDIR} troggle
|
||||
ln -s ${TROGDIR}/../expoweb expoweb
|
||||
ln -s ${TROGDIR}/../loser loser
|
||||
ln -s ${TROGDIR}/../drawings drawings
|
||||
ln -s ${TROGDIR}/../expofiles expofiles
|
||||
|
||||
|
||||
# Package Version
|
||||
# ------------- ----------
|
||||
echo '### links to expoweb, troggle etc. complete'
|
||||
echo '###'
|
||||
echo '### now installing requirements.txt'
|
||||
echo '### now installing ${TROGDIR}/requirements.txt'
|
||||
echo '###'
|
||||
|
||||
$PIP install -r troggle/requirements.txt
|
||||
$PIP install -r ${TROGDIR}/requirements.txt
|
||||
|
||||
echo '### install from requirements.txt completed.'
|
||||
echo '### '
|
||||
@@ -106,7 +146,7 @@ REQ=installation-record
|
||||
mkdir $REQ
|
||||
mv requirements-$VENAME.txt $REQ
|
||||
mv original.txt $REQ
|
||||
#mv requirements.txt $REQ
|
||||
mv requirements.txt $REQ
|
||||
mv original-pip.list $REQ
|
||||
mv installed-pip.list $REQ
|
||||
mv installed-pip-o.list $REQ
|
||||
@@ -114,15 +154,17 @@ 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 "Django version:`django-admin --version`"
|
||||
|
||||
echo "### Now do
|
||||
'sudo service mysql start'
|
||||
'sudo service mariadb restart'
|
||||
'sudo mysql_secure_installation'
|
||||
'cd ../$VENAME'
|
||||
'cd ~/$VENAME'
|
||||
'source bin/activate'
|
||||
'cd troggle'
|
||||
'python manage.py check'
|
||||
'./pre-run.sh'
|
||||
'python manage.py test -v 3' "
|
||||
Reference in New Issue
Block a user