#! /bin/bash
# Last edited on 2021-05-28 03:26:27 by jstolfi

# compares the "00-MODULES.txt" list with the actual ".py" modules.

echo 'differences'  1>&2

cat 00-MODULES.txt \
  | egrep -v -e '^[ ]*([#]|$)' \
  | cut -d ' ' -f 2 \
  | sort \
  > .mods-M

ls {,tests/}*.py \
  | sed -e 's:_IMP::g' -e 's:_TST::g' -e 's:tests/::g' -e 's:[.]py::g' \
  | egrep -v -e '^(rn|rmxn)$' \
  | sort | uniq \
  > .mods-F

prdiff -Bb .mods-M .mods-F 1>&2 

echo 'missing files'  1>&2

for f in `cat .mods-M .mods-F | sort | uniq` ; do 
  if [[ ! ( -s ${f}.py ) ]]; then echo "${f}.py" 1>&2 ; fi
  if [[ ! ( -s ${f}_IMP.py ) ]]; then echo "${f}_IMP.py" 1>&2 ; fi
  if [[ ! ( -s tests/${f}_TST.py ) ]]; then echo "tests/${f}_TST.py" 1>&2 ; fi
done

  
