39 строки
897 B
Bash
Executable File
39 строки
897 B
Bash
Executable File
#!/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
|
|
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "Please install python (version 3.8 or greater)"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$CMD" == "bootstrap" ]; then
|
|
if [ -d "venv" ]; then
|
|
echo 'venv subdirectory already exists, execute "rm -rf venv" and re-run this command if you want to recreate it'
|
|
exit 1
|
|
else
|
|
python3 -m venv venv
|
|
fi
|
|
|
|
venv/bin/pip install --no-deps -r requirements.txt
|
|
venv/bin/pip install -e .
|
|
echo "bqetl configured! It should now be ready for use."
|
|
exit 0
|
|
fi
|
|
|
|
if [ ! -d "venv" ]; then
|
|
echo "Please run ./bqetl bootstrap"
|
|
exit 1
|
|
fi
|
|
|
|
venv/bin/bqetl "$@"
|