| 1 |
#!/bin/bash -e |
| 2 |
|
| 3 |
mbd_modules() |
| 4 |
{ |
| 5 |
local f |
| 6 |
for f in $(./pysources modules); do |
| 7 |
if [ "${f}" == "./setup.py" -o "${f}" == "./manual/conf.py" ]; then # can't be used for doctests |
| 8 |
continue |
| 9 |
fi |
| 10 |
local module="$(basename $(tr '/' '.' <<< ${f:6}) '.py')" |
| 11 |
printf "=> Doctest on %s (%s)...\n" "${f}" "${module}" |
| 12 |
( cd ./src/ && ./run-doctest "${module}" ) |
| 13 |
done |
| 14 |
} |
| 15 |
|
| 16 |
mbd_scripts() |
| 17 |
{ |
| 18 |
local f |
| 19 |
for f in $(./pysources scripts); do |
| 20 |
# Workaround: Temporary *.py symlink, else doctest won't import script |
| 21 |
local f_module="${f}.py" |
| 22 |
ln -s -f "$(basename "${f}")" "${f_module}" |
| 23 |
printf "=> Doctest on script %s (%s)...\n" "${f}" "${f_module}" |
| 24 |
( cd ./src/ && python3 -B -m doctest "../${f_module}" ) |
| 25 |
rm "${f_module}" |
| 26 |
done |
| 27 |
} |
| 28 |
|
| 29 |
python3 ./setup.py version_py |
| 30 |
|
| 31 |
if [ -z "${1}" ]; then |
| 32 |
mbd_modules |
| 33 |
mbd_scripts |
| 34 |
else |
| 35 |
mbd_${1} |
| 36 |
fi |