Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: paul.eggleton@linux.intel.com
Subject: [PATCH V2] selftest/buildoptions: pexpect not a builtin module
Date: Fri, 18 Sep 2015 08:34:05 +0000	[thread overview]
Message-ID: <1442565245-16632-1-git-send-email-benjamin.esquivel@linux.intel.com> (raw)
In-Reply-To: <6871706.tbebiTIoD4@peggleto-mobl.ger.corp.intel.com>

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@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



  reply	other threads:[~2015-09-18 16:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 20:38 [PATCH] selftest/buildoptions: pexpect not a builtin module Benjamin Esquivel
2015-09-18 11:05 ` Burton, Ross
2015-09-18 11:37   ` Paul Eggleton
2015-09-18  8:34     ` Benjamin Esquivel [this message]
2015-09-21  8:37       ` [PATCH V2] " Istrate, Daniel AlexandruX
2015-09-21 10:19         ` Burton, Ross
2015-09-21 10:49           ` Istrate, Daniel AlexandruX
2015-09-21 16:27             ` Benjamin Esquivel
2015-09-18 16:31   ` [PATCH] " Benjamin Esquivel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442565245-16632-1-git-send-email-benjamin.esquivel@linux.intel.com \
    --to=benjamin.esquivel@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox