| 1 | Submitted upstream: https://github.com/ibus/ibus-anthy/pull/35
|
| 2 |
|
| 3 | diff --git a/tests/test-build.sh b/tests/test-build.sh
|
| 4 | index e83b78f..bbfa7e1 100755
|
| 5 | |
| 6 | |
| 7 | @@ -63,26 +63,33 @@ parse_args()
|
| 8 | done;
|
| 9 | }
|
| 10 |
|
| 11 | +maybe_install_pycotap() {
|
| 12 | + # Red Hat specific hint.
|
| 13 | + if test -f /etc/redhat-release ; then
|
| 14 | + if ! rpm -q --quiet python3-pycotap; then
|
| 15 | + echo "Please install python3-pycotap"
|
| 16 | + exit -1
|
| 17 | + fi
|
| 18 | + fi;
|
| 19 | +
|
| 20 | + # Check if pycotap is already available.
|
| 21 | + if ! python3 -m pycotap >/dev/null; then
|
| 22 | + echo "pycotap not found; installing via pip"
|
| 23 | + if ! pip install pycotap --user; then
|
| 24 | + echo "failed to install pycotap"
|
| 25 | + exit -1
|
| 26 | + fi
|
| 27 | + fi
|
| 28 | +}
|
| 29 | +
|
| 30 | init_environment()
|
| 31 | {
|
| 32 | if test x$FORCE_TEST != x ; then
|
| 33 | RUN_ARGS="$RUN_ARGS --force";
|
| 34 | fi;
|
| 35 | - HAS_TAP=0;
|
| 36 | - if test -f /etc/redhat-release ; then
|
| 37 | - rpm -q --quiet python3-pycotap
|
| 38 | - if test $? -ne 0 ; then
|
| 39 | - echo "Not found python3-pycotap";
|
| 40 | - exit -1;
|
| 41 | - fi;
|
| 42 | - HAS_TAP=1;
|
| 43 | - fi;
|
| 44 | - TAP_DIR=`python -m site --user-site`/pycotap;
|
| 45 | - if test $HAS_TAP -ne 1 && \
|
| 46 | - test x"$TAP_DIR" != x && test ! -d "$TAP_DIR" ; then
|
| 47 | - echo "pip install pycotap --user";
|
| 48 | - pip install pycotap --user;
|
| 49 | - fi;
|
| 50 | +
|
| 51 | + maybe_install_pycotap
|
| 52 | +
|
| 53 | if test ! -f $BUILDDIR/../data/$ANTHY_SCHEMA_FILE ; then
|
| 54 | echo "Not found $BUILDDIR/../data/$ANTHY_SCHEMA_FILE";
|
| 55 | exit -1;
|