#!/usr/bin/env bash # http://redsymbol.net/articles/unofficial-bash-strict-mode/ set -euo pipefail IFS=$'\n\t' # Pre-configuration # Set working directory to root cd "$(dirname "$0")/../" CDIR=$(pwd -P) export CDIR VIRTUAL_ENV="${VIRTUAL_ENV:-}" REQUIREMENTS="${CDIR}/backend/requirements.txt" DEV_REQUIREMENTS="${CDIR}/dev_requirements.txt" function sync_env () { if [ -z "${VIRTUAL_ENV}" ]; then echo "warning: you are not in a virtualenv. Skipping sync." exit 1 else echo "Syncing virtualenv" pip-sync $REQUIREMENTS $DEV_REQUIREMENTS fi return 0 } sync_env