From 3158bfb7468621be981564eb030a12a40b1acf8f Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 23 Nov 2023 18:03:57 +0000 Subject: [PATCH] venv updates --- _deploy/xubuntu/os-trog.sh | 10 ++++++++++ requirements-p12d5.txt | 31 ++++++++++++++----------------- venv-trog-d5.sh | 38 +++++++++++++++++++------------------- 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/_deploy/xubuntu/os-trog.sh b/_deploy/xubuntu/os-trog.sh index 6f83494..8d9c0cd 100755 --- a/_deploy/xubuntu/os-trog.sh +++ b/_deploy/xubuntu/os-trog.sh @@ -66,6 +66,7 @@ sudo add-apt-repository ppa:deadsnakes/ppa -y sudo apt update sudo apt install python3.12-full -y sudo apt install python3.12-distutils -y +sudo apt install python3.12-venv -y sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 7 sudo update-alternatives --config python @@ -73,6 +74,15 @@ sudo rm /usr/bin/python3 sudo ln -s /etc/alternatives/python /usr/bin/python3 sudo apt dist-upgrade + +# 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 + #this next crashes, why? #sudo python -m pip install --upgrade pip diff --git a/requirements-p12d5.txt b/requirements-p12d5.txt index fe10a93..e7d0bf1 100755 --- a/requirements-p12d5.txt +++ b/requirements-p12d5.txt @@ -1,23 +1,20 @@ +Pillow==10.1.0 +Unidecode==1.3.7 asgiref==3.7.2 -setuptools==69.0.2 -sqlparse==0.4.4 -asgiref==3.6.0 -BeautifulSoup4==4.12.0 -black==23.1.0 -chardet==5.1.0 -click==8.1.0 +beautifulsoup4==4.12 +black==23.11 +chardet==5.2 +click==8.1 coverage==7.1.0 deptry==0.12.0 -docutils==0.19 +docutils==0.20 isort==5.12.0 mypy-extensions==1.0.0 -packaging==23.0 -pathspec==0.11.0 -piexif==1.1.3 -Pillow==9.4.0 -platformdirs==3.0.0 -pytz==2022.7 -ruff==0.0.245 +packaging==23 +pathspec==0.11 +platformdirs==4.0 +pytz==2023.3 +ruff==0.1 soupsieve==2.5 -sqlparse==0.4.0 -Unidecode==1.3.0 +sqlparse==0.4 +piexif==1.1 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