* [PATCH] selftest/buildoptions: pexpect not a builtin module
@ 2015-09-17 20:38 Benjamin Esquivel
2015-09-18 11:05 ` Burton, Ross
0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Esquivel @ 2015-09-17 20:38 UTC (permalink / raw)
To: openembedded-core; +Cc: paul.eggleton
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"
Signed-off-by: Benjamin Esquivel <benjamin.esquivel@linux.intel.com>
---
meta/lib/oeqa/selftest/buildoptions.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 483803b..9a3c9a1 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -3,7 +3,13 @@ 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))
+ raise e
from oeqa.selftest.base import oeSelfTest
from oeqa.selftest.buildhistory import BuildhistoryBase
--
2.5.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH V2] selftest/buildoptions: pexpect not a builtin module
2015-09-18 11:37 ` Paul Eggleton
@ 2015-09-18 8:34 ` Benjamin Esquivel
2015-09-21 8:37 ` Istrate, Daniel AlexandruX
0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Esquivel @ 2015-09-18 8:34 UTC (permalink / raw)
To: openembedded-core; +Cc: paul.eggleton
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] selftest/buildoptions: pexpect not a builtin module
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 16:31 ` [PATCH] " Benjamin Esquivel
0 siblings, 2 replies; 9+ messages in thread
From: Burton, Ross @ 2015-09-18 11:05 UTC (permalink / raw)
To: Benjamin Esquivel; +Cc: Paul Eggleton, OE-core
[-- Attachment #1: Type: text/plain, Size: 363 bytes --]
On 17 September 2015 at 21:38, Benjamin Esquivel <
benjamin.esquivel@linux.intel.com> wrote:
> 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
>
As the failing import is throwing an exception, can't the calling code
display the exception correctly?
Ross
[-- Attachment #2: Type: text/html, Size: 785 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] selftest/buildoptions: pexpect not a builtin module
2015-09-18 11:05 ` Burton, Ross
@ 2015-09-18 11:37 ` Paul Eggleton
2015-09-18 8:34 ` [PATCH V2] " Benjamin Esquivel
2015-09-18 16:31 ` [PATCH] " Benjamin Esquivel
1 sibling, 1 reply; 9+ messages in thread
From: Paul Eggleton @ 2015-09-18 11:37 UTC (permalink / raw)
To: Burton, Ross, Benjamin Esquivel; +Cc: OE-core
On Friday 18 September 2015 12:05:35 Burton, Ross wrote:
> On 17 September 2015 at 21:38, Benjamin Esquivel <
>
> benjamin.esquivel@linux.intel.com> wrote:
> > 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
>
> As the failing import is throwing an exception, can't the calling code
> display the exception correctly?
If we're going to trap this I think we should be displaying something like
"Please install pexpect (python-pexpect)".
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] selftest/buildoptions: pexpect not a builtin module
2015-09-18 11:05 ` Burton, Ross
2015-09-18 11:37 ` Paul Eggleton
@ 2015-09-18 16:31 ` Benjamin Esquivel
1 sibling, 0 replies; 9+ messages in thread
From: Benjamin Esquivel @ 2015-09-18 16:31 UTC (permalink / raw)
To: Burton, Ross; +Cc: Paul Eggleton, OE-core
[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]
On Fri, 2015-09-18 at 12:05 +0100, Burton, Ross wrote:
>
> On 17 September 2015 at 21:38, Benjamin Esquivel <
> benjamin.esquivel@linux.intel.com> wrote:
> > 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
> >
> As the failing import is throwing an exception, can't the calling
> code display the exception correctly?
This is the logging without the change:
2015-09-18 08:27:44,233 - selftest - INFO - Loading tests from:
oeqa.selftest.buildhistory
2015-09-18 08:27:44,234 - selftest - INFO - Loading tests from:
oeqa.selftest.buildoptions
2015-09-18 08:27:44,236 - selftest - ERROR - Failed to import
oeqa.selftest.buildoptions
2015-09-18 08:27:44,236 - selftest - ERROR - 'module' object has no
attribute 'buildoptions'
This is the logging with the proposed change and including Paul's
comment:
2015-09-18 08:27:44,233 - selftest - INFO - Loading tests from:
oeqa.selftest.buildhistory
2015-09-18 08:27:44,234 - selftest - INFO - Loading tests from:
oeqa.selftest.buildoptions
No module named pexpect, import failed
Please install pexpect (python-pexpect)
2015-09-18 08:27:44,236 - selftest - ERROR - Failed to import
oeqa.selftest.buildoptions
2015-09-18 08:27:44,236 - selftest - ERROR - 'module' object has no
attribute 'buildoptions'
I'm sending the patch V2
> > Ross
>
[-- Attachment #2: Type: text/html, Size: 2010 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] selftest/buildoptions: pexpect not a builtin module
2015-09-18 8:34 ` [PATCH V2] " Benjamin Esquivel
@ 2015-09-21 8:37 ` Istrate, Daniel AlexandruX
2015-09-21 10:19 ` Burton, Ross
0 siblings, 1 reply; 9+ messages in thread
From: Istrate, Daniel AlexandruX @ 2015-09-21 8:37 UTC (permalink / raw)
To: Benjamin Esquivel, openembedded-core; +Cc: paul.eggleton
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@lists.openembedded.org [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of Benjamin Esquivel
Sent: Friday, September 18, 2015 11:34
To: openembedded-core@lists.openembedded.org
Cc: paul.eggleton@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@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@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH V2] selftest/buildoptions: pexpect not a builtin module
2015-09-21 8:37 ` Istrate, Daniel AlexandruX
@ 2015-09-21 10:19 ` Burton, Ross
2015-09-21 10:49 ` Istrate, Daniel AlexandruX
0 siblings, 1 reply; 9+ messages in thread
From: Burton, Ross @ 2015-09-21 10:19 UTC (permalink / raw)
To: Istrate, Daniel AlexandruX; +Cc: paul.eggleton, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 389 bytes --]
On 21 September 2015 at 09:37, Istrate, Daniel AlexandruX <
daniel.alexandrux.istrate@intel.com> wrote:
> 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.
>
Totally agreed. Can you send a quick patch?
Ross
[-- Attachment #2: Type: text/html, Size: 798 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] selftest/buildoptions: pexpect not a builtin module
2015-09-21 10:19 ` Burton, Ross
@ 2015-09-21 10:49 ` Istrate, Daniel AlexandruX
2015-09-21 16:27 ` Benjamin Esquivel
0 siblings, 1 reply; 9+ messages in thread
From: Istrate, Daniel AlexandruX @ 2015-09-21 10:49 UTC (permalink / raw)
To: Burton, Ross; +Cc: paul.eggleton, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 856 bytes --]
Hi Ross,
I sent the patch: http://lists.openembedded.org/pipermail/openembedded-core/2015-September/110738.html
--Daniel
From: Burton, Ross [mailto:ross.burton@intel.com]
Sent: Monday, September 21, 2015 13:20
To: Istrate, Daniel AlexandruX
Cc: Benjamin Esquivel; openembedded-core@lists.openembedded.org; paul.eggleton@linux.intel.com
Subject: Re: [OE-core] [PATCH V2] selftest/buildoptions: pexpect not a builtin module
On 21 September 2015 at 09:37, Istrate, Daniel AlexandruX <daniel.alexandrux.istrate@intel.com<mailto:daniel.alexandrux.istrate@intel.com>> wrote:
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.
Totally agreed. Can you send a quick patch?
Ross
[-- Attachment #2: Type: text/html, Size: 4255 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] selftest/buildoptions: pexpect not a builtin module
2015-09-21 10:49 ` Istrate, Daniel AlexandruX
@ 2015-09-21 16:27 ` Benjamin Esquivel
0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Esquivel @ 2015-09-21 16:27 UTC (permalink / raw)
To: Istrate, Daniel AlexandruX, Burton, Ross; +Cc: paul.eggleton, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
Great! thanks Daniel.
On Mon, 2015-09-21 at 10:49 +0000, Istrate, Daniel AlexandruX wrote:
> Hi Ross,
>
> I sent the patch: http://lists.openembedded.org/pipermail/openembedde
> d-core/2015-September/110738.html
>
> --Daniel
>
> From: Burton, Ross [mailto:ross.burton@intel.com]
> Sent: Monday, September 21, 2015 13:20
> To: Istrate, Daniel AlexandruX
> Cc: Benjamin Esquivel; openembedded-core@lists.openembedded.org;
> paul.eggleton@linux.intel.com
> Subject: Re: [OE-core] [PATCH V2] selftest/buildoptions: pexpect not
> a builtin module
>
>
> On 21 September 2015 at 09:37, Istrate, Daniel AlexandruX <
> daniel.alexandrux.istrate@intel.com> wrote:
> 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.
>
> Totally agreed. Can you send a quick patch?
>
> Ross
[-- Attachment #2: Type: text/html, Size: 4391 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-09-21 16:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH V2] " Benjamin Esquivel
2015-09-21 8:37 ` 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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.