Blame SOURCES/handle-missing-python.patch

e965a0
diff -u b/src/journal.sh b/src/journal.sh
e965a0
--- b/src/journal.sh
e965a0
+++ b/src/journal.sh
e965a0
@@ -283,8 +297,25 @@
e965a0
 #=cut
e965a0
e965a0
 __INTERNAL_JournalXMLCreate() {
e965a0
-    [[ "$BEAKERLIB_JOURNAL" == "0" ]] || $__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
e965a0
-    "$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
e965a0
+    local res=0
e965a0
+    [[ "$BEAKERLIB_JOURNAL" == "0" ]] || {
e965a0
+      if which python &> /dev/null; then
e965a0
+        $__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
e965a0
+          "$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
e965a0
+        res=$?
e965a0
+        if [[ $res -eq 2 ]]; then
e965a0
+          rlLogError "cannot create journal.xml due to missing some python module"
e965a0
+        elif [[ $res -eq 3 ]]; then
e965a0
+          rlLogError "cannot create journal.xml due to missing python lxml module"
e965a0
+        elif [[ $res -ne 0 ]]; then
e965a0
+          rlLogError "journal.xml creation failed!"
e965a0
+        fi
e965a0
+      else
e965a0
+        rlLogError "cannot create journal.xml due to missing python interpreter"
e965a0
+        let res++
e965a0
+      fi
e965a0
+    }
e965a0
+    return $res
e965a0
 }
e965a0
e965a0
e965a0
diff -u b/src/python/journalling.py b/src/python/journalling.py
e965a0
--- b/src/python/journalling.py
e965a0
+++ b/src/python/journalling.py
e965a0
@@ -30,11 +30,15 @@
e965a0
     import six
e965a0
     import time
e965a0
     import base64
e965a0
-    from lxml import etree
e965a0
     from optparse import OptionParser
e965a0
 except ImportError as e:
e965a0
     sys.stderr.write("Python ImportError: " + str(e) + "\nExiting unsuccessfully.\n")
e965a0
-    exit(1)
e965a0
+    exit(2)
e965a0
+try:
e965a0
+    from lxml import etree
e965a0
+except ImportError as e:
e965a0
+    sys.stderr.write("Python ImportError: " + str(e) + "\nExiting unsuccessfully.\n")
e965a0
+    exit(3)
e965a0
e965a0
e965a0
 xmlForbidden = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 14, 15, 16, 17, 18, 19, 20,