1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#!/bin/bash -e
# Find files with python code
declare -a MBD_PYFINDPARAMS=(-not -wholename './debian/*' -not -wholename './.git/*' -not -wholename './build/*' -not -wholename './.pybuild/*' -type f -not -wholename './src/mini_buildd/migrations/*' -type f)
mbd_modules()
{
find -name "*.py" -a \( "${MBD_PYFINDPARAMS[@]}" \) -printf '%p\n'
}
mbd_scripts()
{
_mbd_pip() { head -1 "${1}" | grep --quiet --invert-match "bin/python" || printf "%s\n" "${1}"; } # print if python
export -f _mbd_pip
find \( "${MBD_PYFINDPARAMS[@]}" \) -a -executable -exec bash -c "_mbd_pip '{}'" \;
}
if [ -z "${1}" ]; then
mbd_modules
mbd_scripts
else
mbd_${1}
fi
|