forked from mbuesch/awlsim
-
Notifications
You must be signed in to change notification settings - Fork 2
/
makerelease.sh
executable file
·63 lines (53 loc) · 1.42 KB
/
makerelease.sh
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
#!/bin/sh
srcdir="$(dirname "$0")"
[ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"
die() { echo "$*"; exit 1; }
# Import the makerelease.lib
# http://bues.ch/gitweb?p=misc.git;a=blob_plain;f=makerelease.lib;hb=HEAD
for path in $(echo "$PATH" | tr ':' ' '); do
[ -f "$MAKERELEASE_LIB" ] && break
MAKERELEASE_LIB="$path/makerelease.lib"
done
[ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
hook_get_version()
{
local file="$1/awlsim/core/version.py"
local maj="$(cat "$file" | grep -e VERSION_MAJOR | head -n1 | awk '{print $3;}')"
local min="$(cat "$file" | grep -e VERSION_MINOR | head -n1 | awk '{print $3;}')"
version="$maj.$min"
}
# $1=file
__check_text_encoding()
{
local file="$1"
# Check CR/LF
file -L "$file" | grep -qe 'CRLF line terminators' || {
die "ERROR: '$file' is not in DOS format."
}
# Check file encoding
file -L "$file" | grep -qEe '(ISO-8859 text)|(ASCII text)' || {
die "ERROR: '$file' invalid file encoding."
}
}
# $1=directory
__check_test_dir_encoding()
{
local directory="$1"
for entry in "$directory"/*; do
[ -d "$entry" ] && {
__check_test_dir_encoding "$entry"
continue
}
[ "$(echo -n "$entry" | tail -c4)" = ".awl" ] || continue
__check_text_encoding "$entry"
done
}
hook_regression_tests()
{
__check_test_dir_encoding "$1"/tests
# Run selftests
sh "$1/tests/run.sh"
}
project=awlsim
default_archives=py-sdist
makerelease "$@"