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