Skip to content

Commit

Permalink
Merge pull request #24 from viam-labs/side
Browse files Browse the repository at this point in the history
add build.sh
  • Loading branch information
kharijarrett authored Jul 15, 2024
2 parents cabc26b + a4edd4e commit f00f818
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# setup.sh -- environment bootstrapper for python virtualenv

set -euo pipefail

SUDO=sudo
if ! command -v $SUDO; then
echo no sudo on this system, proceeding as current user
SUDO=""
fi

python_version=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')

if command -v apt-get; then
$SUDO apt-get install python3-venv python$python_version-venv
if dpkg -l python3-venv; then
echo "python3-venv is installed, skipping setup"
else
if ! apt info python3-venv; then
echo python3-venv package info not found, trying apt update
$SUDO apt-get -qq update
fi
$SUDO apt-get install -qqy python3-venv
fi
else
echo Skipping tool installation because your platform is missing apt-get.
echo If you see failures below, install the equivalent of python3-venv for your system.
fi

source .env
echo creating virtualenv at $VIRTUAL_ENV
python3 -m venv $VIRTUAL_ENV
echo installing dependencies from requirements.txt
$VIRTUAL_ENV/bin/pip install -r requirements.txt -U
source $VIRTUAL_ENV/bin/activate
$PYTHON -m PyInstaller --onefile --hidden-import="googleapiclient" --add-data="./src:src" src/main.py
tar -czvf dist/archive.tar.gz dist/main

0 comments on commit f00f818

Please sign in to comment.