#!/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

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

SETUP=setup.py
echo '>>> finding all $SETUP'
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
#    to_keep=$(basename -s $item)
#    echo $to_keep
done


