2021-01-06 19:11:20 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Absolute path this script is in
|
|
|
|
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
|
|
CMD=$1
|
|
|
|
|
|
|
|
if [ "$PWD" != "$SCRIPT_PATH" ]; then
|
|
|
|
echo "Please run this command from the root of your bigquery-etl checkout ($SCRIPT_PATH)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-08-17 00:01:07 +03:00
|
|
|
if ! command -v python3 &> /dev/null; then
|
|
|
|
echo "Please install python (version 3.8 or greater)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-06 19:11:20 +03:00
|
|
|
if [ "$CMD" == "bootstrap" ]; then
|
|
|
|
if [ -d "venv" ]; then
|
2021-05-04 20:02:56 +03:00
|
|
|
echo 'venv subdirectory already exists, execute "rm -rf venv" and re-run this command if you want to recreate it'
|
2021-08-17 00:01:07 +03:00
|
|
|
exit 1
|
2021-01-06 19:11:20 +03:00
|
|
|
else
|
2021-08-17 00:01:07 +03:00
|
|
|
python3 -m venv venv
|
2021-01-06 19:11:20 +03:00
|
|
|
fi
|
2021-08-17 00:01:07 +03:00
|
|
|
|
2022-02-25 00:36:47 +03:00
|
|
|
venv/bin/pip install --no-deps -r requirements.txt
|
2021-01-06 19:11:20 +03:00
|
|
|
venv/bin/pip install -e .
|
2021-03-30 18:57:59 +03:00
|
|
|
echo "bqetl configured! It should now be ready for use."
|
|
|
|
exit 0
|
2021-01-06 19:11:20 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d "venv" ]; then
|
|
|
|
echo "Please run ./bqetl bootstrap"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-02-12 00:27:42 +03:00
|
|
|
venv/bin/bqetl "$@"
|