This repository has been archived by the owner on Dec 29, 2019. It is now read-only.
forked from dtmilano/AndroidViewClient
-
Notifications
You must be signed in to change notification settings - Fork 1
/
avc-version
executable file
·73 lines (64 loc) · 1.73 KB
/
avc-version
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#! /bin/bash
usage()
{
echo "usage: $0 {get | set <version>}"
exit 1
}
set +x
if [[ $# < 1 ]]
then
usage
fi
version_str='__version__ ='
case "$1" in
get)
(
for f in $(find src tools -type f -exec grep -l "$version_str" {} \;)
do
echo -n "$f: "
grep "$version_str" $f
done
echo -n "setup.py: "
grep version setup.py
) | awk "
BEGIN { FS = \"[=:]+\"; max=-1 };
{ gsub(/[,' ]+/, \"\", \$NF); files[NR]=\$1; v=\$NF; versions[NR]=v; if (v > max) max=v;}
END {
for (i in files) {
if (versions[i] == max) {
s=\" MAX\"
} else {
s = \"\"};
printf(\"%-45s: %s%s\\n\", files[i], versions[i], s)};
}
"
;;
set)
if [[ $# != 2 ]]
then
usage
fi
version="$2"
for f in $(find src tools -type f -exec grep -l "$version_str" {} \;)
do
echo "<<< $f >>>"
case "$(uname)" in
Darwin)
sed -E -i '' -e "s@$version_str \'[0-9r.]+\'@$version_str \'$version\'@" $f
;;
Linux)
sed -E -i -e "s@$version_str '[0-9r.]+'@$version_str '$version'@" $f
;;
esac
done
echo "<<< setup.py >>>"
case "$(uname)" in
Darwin)
sed -E -i '' -e "s@version='[0-9r.]+'@version='$version'@" setup.py
;;
Linux)
sed -E -i -e "s@version='[0-9r.]+'@version='$version'@" setup.py
;;
esac
;;
esac