5 echo "PyQt qt_versioning.sh: $*" >&2
9 [ $# -eq 3 ] || die
"Invalid arguments"
15 cp -f "$qtincdir/QtCore/qglobal.h" "$tmpfile" || die
"cp failed"
16 echo "int QT_VERSION_IS = QT_VERSION;" >> "$tmpfile" || die
"patching failed (1)"
17 echo "int QT_EDITION_IS = QT_EDITION;" >> "$tmpfile" || die
"patching failed (2)"
18 # First resolve all preprocessor macros
19 cpp
-x c
++ -traditional-cpp "-I$qtincdir" "$tmpfile" > "$tmpfile.processed" || die
"CPP failed"
21 if [ "$action" = "version" ]; then
22 raw
="$(grep -e 'QT_VERSION_IS' "$tmpfile.processed
" | cut -d'=' -f2 | cut -d';' -f1)"
23 elif [ "$action" = "edition" ]; then
24 raw
="$(grep -e 'QT_EDITION_IS' "$tmpfile.processed
" | cut -d'=' -f2 | cut -d';' -f1)"
28 # We use python to evaluate the arithmetic C++ expression. Languages are similar
29 # enough in that area for this to succeed.
30 python
-c "print \"%d\" % ($raw)" || die
"C++ evaluation failed"