From bbb8b1dc15e4adcee04ea4b29839218170b9c187 Mon Sep 17 00:00:00 2001 From: ocueye Date: Mon, 11 Nov 2024 16:33:51 +0000 Subject: [PATCH] created pypack --- pypack/requirements.txt | 1 + run.sh | 36 ++++++++++++++++++++++++++++++++++++ start.py | 2 ++ 3 files changed, 39 insertions(+) create mode 100644 pypack/requirements.txt create mode 100755 run.sh create mode 100644 start.py diff --git a/pypack/requirements.txt b/pypack/requirements.txt new file mode 100644 index 0000000..59dcaa4 --- /dev/null +++ b/pypack/requirements.txt @@ -0,0 +1 @@ +cherrypy \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..93e18fe --- /dev/null +++ b/run.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +#pypack +#by ocueye2 + +version="3.12" +program="start.py" + +# check if venv exists (to see if script has run before) +if [[ -f "pypack/.venv/env/bin/activate" ]] +then + echo "starting" +else + echo "installing" +cd pypack +sudo apt update + +# install requirements +if ! command -v "python$version" &> /dev/null +then + sudo apt-get install "python$version" +fi + + + # make a venv + mkdir .venv + cd .venv + "python$version" -m venv env + source env/bin/activate + cd .. + pip install -r requirements.txt + cd .. + deactivate +fi +source pypack/.venv/env/bin/activate +python "$program" diff --git a/start.py b/start.py new file mode 100644 index 0000000..5c68f32 --- /dev/null +++ b/start.py @@ -0,0 +1,2 @@ +import cherrypy +print("complete") \ No newline at end of file