-
Notifications
You must be signed in to change notification settings - Fork 0
/
freecadPythonCheck
executable file
·41 lines (31 loc) · 1.01 KB
/
freecadPythonCheck
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
#!/bin/sh
# check version of python used by Sphinx/freecad as written
# in ${BUILD}/html/index.html and compare with what was suppose to be used.
# Return an error if they are not the same
version="0.1"
usage="Usage:\n ./freecadPythonCheck build-dir\n ./freecadPythonCheck build\n"
case $# in
0)echo "${usage}"; exit 1 ;;
1) ;;
*) echo "${usage}"; exit 1 ;;
esac
case ${1} in
-h|--help)
echo "${usage}"; exit 0 ;;
-v|--version)
echo "${version}"; exit 0 ;;
*) break ;;
esac
echo TRAVIS_PYTHON_VERSION is $TRAVIS_PYTHON_VERSION
echo Comparing with python in $1/html/index.html
ZZ=`grep "and Python" $1/html/index.html`
echo Python version used in html build $ZZ
# 7th word on line (6 counting from 0)
CMD="import sys;[sys.stdout.write('.'.join(ln.split(' ')[6].split('.')[0:2])) for ln in sys.stdin]"
ZZZ=`echo ${ZZ} | python -c "$CMD" `
if [ v${ZZZ} = v${TRAVIS_PYTHON_VERSION} ] ; then
exit 0 ;
else
echo "Error. Not using correct Python version (using ${ZZZ})"
exit 1 ;
fi