[OE-core] [PATCH V2] selftest/buildoptions: pexpect not a builtin module

Benjamin Esquivel benjamin.esquivel at linux.intel.com
Fri Sep 18 08:34:05 UTC 2015


put the import of pexpect around a try statement so it can tell you
why it failed to import when in a system that has the module unreachable

the message that outputs is:

"No module named pexpect, import failed"
"Please install pexpect (python-pexpect)"

Signed-off-by: Benjamin Esquivel <benjamin.esquivel at linux.intel.com>
---
 meta/lib/oeqa/selftest/buildoptions.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 483803b..1fa4802 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -3,7 +3,14 @@ import os
 import logging
 import re
 import glob as g
-import pexpect as p
+
+try:
+    import pexpect as p
+except  ImportError as e:
+    import sys
+    sys.stderr.write("{}, import failed\n".format(e))
+    sys.stderr.write("Please install pexpect (python-pexpect)\n")
+    raise e
 
 from oeqa.selftest.base import oeSelfTest
 from oeqa.selftest.buildhistory import BuildhistoryBase
-- 
2.5.1




More information about the Openembedded-core mailing list