From 3effc58ab083e9ee91d44fc153eb0d4672906441 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Tue, 30 Sep 2014 15:21:21 -0400 Subject: [PATCH] Fix the way we try for missing binary dependencies in the installations app Issue #50. Thanks to Ford Guo (@fordguo) for the reporting. --- mayan/apps/installation/models.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mayan/apps/installation/models.py b/mayan/apps/installation/models.py index b04ca35d24..9b8fa6f7ad 100644 --- a/mayan/apps/installation/models.py +++ b/mayan/apps/installation/models.py @@ -74,29 +74,32 @@ class Installation(SingletonModel): def binary_dependencies(self): namespace = PropertyNamespace('bins', _(u'Binary dependencies')) - tesseract = sh.Command(TESSERACT_PATH) try: - namespace.add_property('tesseract', _(u'tesseract version'), tesseract('-v').stderr, report=True) + tesseract = sh.Command(TESSERACT_PATH) except sh.CommandNotFound: namespace.add_property('tesseract', _(u'tesseract version'), _(u'not found'), report=True) except Exception: namespace.add_property('tesseract', _(u'tesseract version'), _(u'error getting version'), report=True) + else: + namespace.add_property('tesseract', _(u'tesseract version'), tesseract('-v').stderr, report=True) - unpaper = sh.Command(UNPAPER_PATH) try: - namespace.add_property('unpaper', _(u'unpaper version'), unpaper('-V').stdout, report=True) + unpaper = sh.Command(UNPAPER_PATH) except sh.CommandNotFound: namespace.add_property('unpaper', _(u'unpaper version'), _(u'not found'), report=True) except Exception: namespace.add_property('unpaper', _(u'unpaper version'), _(u'error getting version'), report=True) + else: + namespace.add_property('unpaper', _(u'unpaper version'), unpaper('-V').stdout, report=True) - pdftotext = sh.Command(PDFTOTEXT_PATH) try: - namespace.add_property('pdftotext', _(u'pdftotext version'), pdftotext('-v').stderr, report=True) + pdftotext = sh.Command(PDFTOTEXT_PATH) except sh.CommandNotFound: namespace.add_property('pdftotext', _(u'pdftotext version'), _(u'not found'), report=True) except Exception: namespace.add_property('pdftotext', _(u'pdftotext version'), _(u'error getting version'), report=True) + else: + namespace.add_property('pdftotext', _(u'pdftotext version'), pdftotext('-v').stderr, report=True) def mayan_properties(self): namespace = PropertyNamespace('mayan', _(u'Mayan EDMS'))