[OE-core] [PATCH V2] selftest/buildoptions: pexpect not a builtin module
Istrate, Daniel AlexandruX
daniel.alexandrux.istrate at intel.com
Mon Sep 21 08:37:42 UTC 2015
Hi Benjamin, Paul,
Just want to point out that 'pexpect' is an unused import in buildoptions.py. Unused imports are also unittest and logging.
Instead of try-catch an import that is not used I think it's best to get rid of them.
--Daniel
-----Original Message-----
From: openembedded-core-bounces at lists.openembedded.org [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf Of Benjamin Esquivel
Sent: Friday, September 18, 2015 11:34
To: openembedded-core at lists.openembedded.org
Cc: paul.eggleton at linux.intel.com
Subject: [OE-core] [PATCH V2] selftest/buildoptions: pexpect not a builtin module
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
--
_______________________________________________
Openembedded-core mailing list
Openembedded-core at lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
More information about the Openembedded-core
mailing list