-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from viam-labs/side
add build.sh
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|