Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

Commit

Permalink
Point of Giving Up
Browse files Browse the repository at this point in the history
  • Loading branch information
leadnaut committed Sep 9, 2024
1 parent 99d0a6c commit 831f4a5
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
8 changes: 8 additions & 0 deletions bootstrap/apt_packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
libcap-dev
libcamera-dev
libatlas-base-dev
ffmpeg
libopenjp2-7
libkms++-dev
libfmt-dev
libdrm-dev
34 changes: 28 additions & 6 deletions bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ERROR="[\033[1;31mERROR\033[0m]"
SSHTARGET=$1
SSHUSER=$2

if ! nc -z $SSHTARGET 22 2>/dev/null; then
if ! nc -z $SSHTARGET 22 2> /dev/null; then
echo -e "$ERROR Cannot find target"
exit 1
fi
Expand All @@ -27,13 +27,35 @@ else
SSH_PREFIX="sshpass -p $PASSWORD"
fi

if $SSH_PREFIX ssh "$SSHUSER@$SSHTARGET" 'command -v python3.10 > /dev/null'; then
echo -e "$WARN It appears Python3.10 already exists on target. I won't compile it again."
SSH_GO="$SSH_PREFIX ssh $SSHUSER@$SSHTARGET"

echo -e $INFO Installing and Compiling Python
if $SSH_GO 'command -v python3.10 > /dev/null'; then
echo -e "$INFO It appears Python3.10 already exists on target. I won't compile it again."
else
echo -e $INFO Installing and Compiling Python
if ! $SSH_PREFIX ssh "$SSHUSER@$SSHTARGET" 'bash -s' < python_install.sh; then
if ! $SSH_GO 'bash -s' < python_install.sh; then
echo -e $ERROR Something went wrong... please check above.
exit 1
fi
echo -e $INFO Python successfully installed!
echo -e $INFO Python3.10 installed
fi

echo -e $INFO Installing uv
if $SSH_GO 'test -f ~/.cargo/bin/uv'; then
echo -e "$INFO uv already installed"
else
if ! $SSH_GO 'curl -LsSf https://astral.sh/uv/install.sh | sh'; then
echo -e $ERROR uv installation failed
exit 1
fi
echo -e $INFO uv installed
fi

echo -e $INFO Copying Dependency Data
$SSH_PREFIX scp ../{pyproject.toml,requirements_uvonly.in,README.md} ./apt_packages.txt $SSHUSER@$SSHTARGET:~/
echo -e $INFO Installing apt packages
$SSH_GO "xargs -a apt_packages.txt sudo apt-get install -y"
echo -e $INFO Compiling dependencies
$SSH_GO "~/.cargo/bin/uv pip compile pyproject.toml requirements_uvonly.in -o requirements.txt"
echo -e $INFO Installing dependencies
$SSH_GO "sudo ~/.cargo/bin/uv pip install --system --python 3.10 -r requirements.txt"
10 changes: 10 additions & 0 deletions bootstrap/install_libcamera.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash
#I'm running on the Pi and I assume I can see pyproject.toml, requirements_uvonly.in
# and apt_packages.txt

sudo swapoff -a
sudo fallocate -l 4G /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

sudo python3.10 -m pip install rpi-libcamera -C setup-args="-Dversion=unknown"
1 change: 1 addition & 0 deletions bootstrap/python_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if ! sudo make altinstall; then
exit 1
fi

cd ../
echo -e "Cleaning up"
sudo rm Python-3.10.12.tgz
sudo rm -r Python-3.10.12
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ sphinx-autobuild = "^2024.4.16"
sphinxcontrib-apidoc = "^0.5.0"
piccolo-theme = "^0.23.0"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"


4 changes: 4 additions & 0 deletions requirements_uvonly.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rpi-kms
rpi-libcamera
picamera2
RPi.GPIO

0 comments on commit 831f4a5

Please sign in to comment.