All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Python3 runqemu: remove use of subprocess.run()
@ 2016-09-07 16:09 Joshua Lock
  2016-09-07 16:09 ` [PATCH 1/1] " Joshua Lock
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Lock @ 2016-09-07 16:09 UTC (permalink / raw)
  To: openembedded-core

Note: This patch is against master-next, as the Python 3 runqemu hasn't made it
to master yet.

Use of subprocess.run() in recent runqemu changes (by me) elevates the Python 3
requirement from 3.4+ to 3.5+. Replace subprocess.run() with 
subprocess.check_output(), as that is available in Python 3.1+

Changes since v1:
* Fix printing of error message in exception handler

The following changes since commit 3df3462d81216d8b26a87d9915abd9de1b2c2faa:

  bitbake: cooker: record events on cooker exit (2016-09-06 23:18:06 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib joshuagl/runqemu
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=joshuagl/runqemu

Joshua Lock (1):
  runqemu: remove use of subprocess.run()

 scripts/runqemu | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] runqemu: remove use of subprocess.run()
  2016-09-07 16:09 [PATCH 0/1] Python3 runqemu: remove use of subprocess.run() Joshua Lock
@ 2016-09-07 16:09 ` Joshua Lock
  0 siblings, 0 replies; 3+ messages in thread
From: Joshua Lock @ 2016-09-07 16:09 UTC (permalink / raw)
  To: openembedded-core

We aim to support Python 3.4+ whereas subprocess.run() was added
in Python 3.5.
Replace subprocess.run() with subprocess.check_output().

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
---
 scripts/runqemu | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 0a56c60..27108ee 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -858,10 +858,11 @@ class BaseConfig(object):
             cmd = 'bitbake -e'
 
         logger.info('Running %s...' % cmd)
-        proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE)
-        if proc.returncode != 0:
-            logger.warn("Couldn't run 'bitbake -e' to gather environment information")
-        self.bitbake_e = proc.stdout.decode('utf-8')
+        try:
+            self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8')
+        except subprocess.CalledProcessError as err:
+            self.bitbake_e = ''
+            logger.warn("Couldn't run 'bitbake -e' to gather environment information/\n%s" % err.output.decode('utf-8'))
 
 def main():
     if len(sys.argv) == 1 or "help" in sys.argv:
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 0/1] Python3 runqemu: remove use of subprocess.run()
@ 2016-09-07 14:10 Joshua Lock
  0 siblings, 0 replies; 3+ messages in thread
From: Joshua Lock @ 2016-09-07 14:10 UTC (permalink / raw)
  To: openembedded-core

Note: This patch is against master-next, as the Python 3 runqemu hasn't made it
to master yet.

Use of subprocess.run() in recent runqemu changes (by me) elevates the Python 3
requirement from 3.4+ to 3.5+. Replace subprocess.run() with 
subprocess.check_output(), as that is available in Python 3.1+

The following changes since commit 3df3462d81216d8b26a87d9915abd9de1b2c2faa:

  bitbake: cooker: record events on cooker exit (2016-09-06 23:18:06 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib joshuagl/runqemu
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=joshuagl/runqemu

Joshua Lock (1):
  runqemu: remove use of subprocess.run()

 scripts/runqemu | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-07 16:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-07 16:09 [PATCH 0/1] Python3 runqemu: remove use of subprocess.run() Joshua Lock
2016-09-07 16:09 ` [PATCH 1/1] " Joshua Lock
  -- strict thread matches above, loose matches on Subject: below --
2016-09-07 14:10 [PATCH 0/1] Python3 " Joshua Lock

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.