File: replace_header.sh

package info (click to toggle)
pymvpa 0.4.5~dev23-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,884 kB
  • ctags: 3,480
  • sloc: python: 25,450; cpp: 2,663; ansic: 445; makefile: 426; sh: 194
file content (38 lines) | stat: -rw-r--r-- 1,429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# emacs: -*- mode: shell-script; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- 
# vi: set ft=sh sts=4 ts=4 sw=4 noet:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
#   See COPYING file distributed along with the PyMVPA package for the
#   copyright and license terms.
#
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##

#echo "./tests/crossval.py" | \
#echo "tests/test_algorithms.py" | \
#echo "mvpa/datasets/mapper.py" | \
find -iname '*.py' | \
	while read fname; do
		grep -q  'This package is distributed in the hope' $fname || continue
		
		descr="`grep '[#"]* *PyMVPA: ' "$fname"  | head -1 | sed -e 's/^.*PyMVPA: //g' -e 's/"""//g'`"
		[ "$descr" == "" ] && \
			descr="`sed -n -e '/###/,/^[^#]/p' "$fname"  | grep '"""' | head -1 | sed -e 's/^"""\(PyMVPA: *\)*\(.*\)"""/\2/g'`"
		[ "$descr" == "" ] && \
			descr="`sed -n -e '/###/,/^[^#]/p' $fname | sed -n -e '3s/^# *//gp'`"
		echo "$fname:$descr"

		cat $fname \
			| sed -e '0,/### ###/d' -e '0,/### ###/d' \
			| sed -e '1rdoc/misc/header.py' \
			| sed -e 's/\t/    /g' \
			| sed -n -e "s/\(\"PyMVPA: \)\"/\1${descr}\"/g" -e '2,$p' \
            | sed -e 's/ -- loosely implemented//g' \
			| sponge $fname

done

exit 0
problematic: mvpa/misc/fsl/__init__.py -- removed header completely for some reason...
 tests/test_algorithms.py os gone!
mvpa/datasets/mapper.py is gone