diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 14:55:04 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 16:05:02 +0100 |
commit | 2253e9f12734c6e6aa489942b5e4628eca1fa29d (patch) | |
tree | cdd9bc62026e1eff49569f025a95fcecde88c78b /meta/lib | |
parent | b9a1b9ad55c0f9fec082ffa37e576d8fd664becd (diff) | |
download | openembedded-core-2253e9f12734c6e6aa489942b5e4628eca1fa29d.tar.gz openembedded-core-2253e9f12734c6e6aa489942b5e4628eca1fa29d.tar.bz2 openembedded-core-2253e9f12734c6e6aa489942b5e4628eca1fa29d.zip |
classes/lib: Fix getcmdstatus breakage
I mistakenly thought subprocess had getcmdstatus in python 2. It doesn't so lets
add a wrapper and have this work in both worlds.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/patch.py | 4 | ||||
-rw-r--r-- | meta/lib/oe/utils.py | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index 8de73a7037..244f6c5cf2 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -17,7 +17,7 @@ class CmdError(bb.BBHandledException): def runcmd(args, dir = None): - import subprocess, pipes + import pipes if dir: olddir = os.path.abspath(os.curdir) @@ -30,7 +30,7 @@ def runcmd(args, dir = None): args = [ pipes.quote(str(arg)) for arg in args ] cmd = " ".join(args) # print("cmd: %s" % cmd) - (exitstatus, output) = subprocess.getstatusoutput(cmd) + (exitstatus, output) = oe.utils.getstatusoutput(cmd) if exitstatus != 0: raise CmdError(exitstatus >> 8, output) return output diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index ed9409613a..ec8260d9bd 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -1,3 +1,10 @@ +try: + # Python 2 + import commands as cmdstatus +except ImportError: + # Python 3 + import subprocess as cmdstatus + def read_file(filename): try: f = file( filename, "r" ) @@ -123,3 +130,6 @@ def packages_filter_out_system(d): if pkg not in blacklist and localepkg not in pkg: pkgs.append(pkg) return pkgs + +def getstatusoutput(cmd): + return cmdstatus.getstatusoutput(cmd) |