bigquery-etl/bqetl

44 строки
1.2 KiB
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
# set this so we don't attempt to recompile pandas and numpy on more recent versions of Mac
# may be unnecessary once Mac OS X 11 wheels become commonplace
# see e.g. https://github.com/scipy/scipy/issues/13102#issuecomment-788160041
export SYSTEM_VERSION_COMPAT=1
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 "$@"