From 5f173e5acb42b8bc594e3b8b3d5c9b42b5b4ea68 Mon Sep 17 00:00:00 2001 From: fritz-hh Date: Sat, 27 Sep 2014 00:53:10 +0200 Subject: [PATCH] return right return code Python does not map the expression to its return code automatically, so this line returns success regardless of the reportlab version installed. (I also realized that hasattr is superfluous). --- OCRmyPDF.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OCRmyPDF.sh b/OCRmyPDF.sh index fa7c6d43..ded1187b 100755 --- a/OCRmyPDF.sh +++ b/OCRmyPDF.sh @@ -148,8 +148,9 @@ cd "$BASEPATH" [ $PREPROCESS_CLEAN -eq 1 ] && ! command -v unpaper > /dev/null && echo "Please install unpaper. Exiting..." && exit $EXIT_MISSING_DEPENDENCY ! command -v tesseract > /dev/null && echo "Please install tesseract and tesseract-data. Exiting..." && exit $EXIT_MISSING_DEPENDENCY ! python2 -c 'import lxml' 2>/dev/null && echo "Please install the python library lxml. Exiting..." && exit $EXIT_MISSING_DEPENDENCY -! python2 -c 'import reportlab; hasattr(reportlab, "Version") and reportlab.Version >= "3.0"' 2>/dev/null \ +! python2 -c 'import sys, reportlab; (getattr(reportlab, "Version", "0.0") >= "3.0") or sys.exit(1)' 2>/dev/null \ && echo "Please install the python library reportlab. Exiting..." && exit $EXIT_MISSING_DEPENDENCY + ! command -v gs > /dev/null && echo "Please install ghostscript. Exiting..." && exit $EXIT_MISSING_DEPENDENCY ! command -v java > /dev/null && echo "Please install java. Exiting..." && exit $EXIT_MISSING_DEPENDENCY