#!/bin/bash

# Convenience script to set up conda environment, if necessary,
# then run "python setup.py develop" in each module.

TOP_LEVEL=/Users/jgoldste/Projects/data/
cd $TOP_LEVEL

if [ -z $CONDA_DEFAULT_ENV ]
then
  echo '>>> Updating conda environment....'
  conda env update
  echo '>>> Activating....'
  conda activate data
else
  echo "conda environment '${CONDA_DEFAULT_ENV}' is active"
fi

SETUP=setup.py
echo ">>> looking for ${SETUP} in all modules...."
SETUPS=$(find . -name $SETUP -exec echo '{}' \;)
for item in $SETUPS
do
  dir=$(dirname $item)
  echo ">>> running ${SETUP} in ${dir}...."
  cd ${dir}

  python setup.py develop
done


