@@ -29,16 +29,16 @@ if [ -z "$ASTYLE" ]; then
29
29
fi
30
30
31
31
if ! type -p flip > /dev/null; then
32
- if type -p dos2unix > /dev/null; then
33
- flip () {
34
- dos2unix -k $2
35
- }
36
- else
37
- echo " flip not found" >&2
38
- flip () {
39
- :
40
- }
41
- fi
32
+ if type -p dos2unix > /dev/null; then
33
+ flip () {
34
+ dos2unix -k $2
35
+ }
36
+ else
37
+ echo " flip not found" >&2
38
+ flip () {
39
+ :
40
+ }
41
+ fi
42
42
fi
43
43
44
44
if ! type -p autopep8 > /dev/null; then
@@ -76,43 +76,50 @@ astyleit()
76
76
77
77
for f in " $@ " ; do
78
78
case " $f " in
79
- src/app/gps/qwtpolar-* |src/core/gps/qextserialport/* |src/plugins/grass/qtermwidget/* |src/astyle/* |python/ext-libs/* |src/providers/spatialite/qspatialite/* |src/plugins/dxf2shp_converter/dxflib/src/* |src/plugins/globe/osgEarthQt/* |src/plugins/globe/osgEarthUtil/* |python/ext-libs/* |* /ui_* .py)
80
- echo -ne " $f skipped $elcr "
81
- continue
82
- ;;
83
-
84
- * .cpp|* .h|* .c|* .h|* .cxx|* .hxx|* .c++|* .h++|* .cc|* .hh|* .C|* .H|* .hpp)
85
- if [ -x " $f " ]; then
86
- chmod a-x " $f "
87
- fi
88
- cmd=astyleit
89
- ;;
90
-
91
- * .ui|* .qgm|* .txt|* .t2t|resources/context_help/* )
92
- cmd=:
93
- ;;
94
-
95
- * .py)
96
- # cmd="autopep8 --in-place --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701"
97
- cmd=" autopep8 --in-place --ignore=E261,E402,E501"
98
- ;;
99
-
100
- * .sip)
101
- cmd=" perl -i.prepare -pe 's/[\r\t ]+$//; s#^(\s*)/\*[*!]\s*([^\s*].*)\s*\$ #\$ 1/** \u\$ 2\n#;'"
102
- ;;
103
-
104
- * )
105
- echo -ne " $f skipped $elcr "
106
- continue
107
- ;;
108
- esac
79
+ src/app/gps/qwtpolar-* |src/core/gps/qextserialport/* |src/plugins/grass/qtermwidget/* |src/astyle/* |python/ext-libs/* |src/providers/spatialite/qspatialite/* |src/plugins/dxf2shp_converter/dxflib/src/* |src/plugins/globe/osgEarthQt/* |src/plugins/globe/osgEarthUtil/* |python/ext-libs/* |* /ui_* .py)
80
+ echo -ne " $f skipped $elcr "
81
+ continue
82
+ ;;
83
+
84
+ * .cpp|* .h|* .c|* .h|* .cxx|* .hxx|* .c++|* .h++|* .cc|* .hh|* .C|* .H|* .hpp)
85
+ if [ -x " $f " ]; then
86
+ chmod a-x " $f "
87
+ fi
88
+ cmd=astyleit
89
+ ;;
90
+
91
+ * .ui|* .qgm|* .txt|* .t2t|resources/context_help/* )
92
+ cmd=:
93
+ ;;
94
+
95
+ * .py)
96
+ # cmd="autopep8 --in-place --ignore=E111,E128,E201,E202,E203,E211,E221,E222,E225,E226,E227,E231,E241,E261,E265,E272,E302,E303,E501,E701"
97
+ cmd=" autopep8 --in-place --ignore=E261,E402,E501"
98
+ ;;
99
+
100
+ * .sip)
101
+ cmd=" perl -i.prepare -pe 's/[\r\t ]+$//; s#^(\s*)/\*[*!]\s*([^\s*].*)\s*\$ #\$ 1/** \u\$ 2\n#;'"
102
+ ;;
103
+
104
+ * )
105
+ echo -ne " $f skipped $elcr "
106
+ continue
107
+ ;;
108
+ esac
109
109
110
110
if ! [ -f " $f " ]; then
111
111
echo " $f not found" >&2
112
112
continue
113
- fi
113
+ fi
114
+
115
+ flip -ub " $f "
116
+ eval " $cmd '$f '"
117
+ if [[ -f $f && ` head -c 3 $f ` == $' \xef\xbb\xbf ' ]]; then
118
+ mv $f $f .bom
119
+ tail -c +4 $f .bom > $f
120
+ echo " removed BOM from $f "
121
+ fi
114
122
115
- flip -ub " $f "
116
123
# qgsloggermig.pl "$f"
117
- eval " $cmd '$f '"
124
+ eval " $cmd '$f '"
118
125
done
0 commit comments