diff options
Diffstat (limited to 'venv-trog-d5.sh')
-rwxr-xr-x | venv-trog-d5.sh | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/venv-trog-d5.sh b/venv-trog-d5.sh index e70a49a..667a4b8 100755 --- a/venv-trog-d5.sh +++ b/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.12 -VENAME=p12d5 # python3.x and django 4.2 +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." @@ -106,11 +112,7 @@ 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} @@ -118,14 +120,17 @@ echo "### install from ${TROGDIR}/${REQUIRE} completed." echo '### ' # this installs pre-release django 5.0 -$PIP install --pre django +if [[ "${VENAME:(-1)}" == 5 ]]; then + echo "### Installing pre-release version of Django" + $PIP install --pre django +fi -$PIP freeze > $REQUIRE +$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 @@ -139,22 +144,17 @@ $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 -# install VS code -sudo apt install software-properties-common apt-transport-https wget gpg -wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg -sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg -sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' -sudo apt update -sudo apt install code + $PYTHON --version python --version |