File: pysources

package info (click to toggle)
mini-buildd 2.4.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,632 kB
  • sloc: python: 9,994; sql: 1,597; sh: 1,466; javascript: 98; lisp: 90; cpp: 70; makefile: 69
file content (23 lines) | stat: -rwxr-xr-x 653 bytes parent folder | download | duplicates (5)
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