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