summaryrefslogtreecommitdiff
path: root/meta/classes/spdx.bbclass
diff options
context:
space:
mode:
authorStephano Cetola <stephano.cetola@linux.intel.com>2016-09-29 15:50:24 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-30 17:48:33 +0100
commit0d6b7276003f1afabc6de683f663540327d52bdc (patch)
tree8f54884c51aff575e8b392100b9e2a434c71eb18 /meta/classes/spdx.bbclass
parent901ccb3e70e9036112c51acc6d18d05025f6e1bb (diff)
downloadopenembedded-core-0d6b7276003f1afabc6de683f663540327d52bdc.tar.gz
openembedded-core-0d6b7276003f1afabc6de683f663540327d52bdc.tar.bz2
openembedded-core-0d6b7276003f1afabc6de683f663540327d52bdc.zip
subprocess: remove Popen in favor of check_output
This begins moving away from the deprecated subprocess calls in an effort to eventually move to some more global abstraction using the run convenience method provided in python 3.5. [ YOCTO #9342 ] Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/spdx.bbclass')
-rw-r--r--meta/classes/spdx.bbclass11
1 files changed, 5 insertions, 6 deletions
diff --git a/meta/classes/spdx.bbclass b/meta/classes/spdx.bbclass
index 0c9276584c..89394d3a96 100644
--- a/meta/classes/spdx.bbclass
+++ b/meta/classes/spdx.bbclass
@@ -219,14 +219,13 @@ def hash_string(data):
def run_fossology(foss_command, full_spdx):
import string, re
import subprocess
-
- p = subprocess.Popen(foss_command.split(),
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- foss_output, foss_error = p.communicate()
- if p.returncode != 0:
+
+ try:
+ foss_output = subprocess.check_output(foss_command.split(),
+ stderr=subprocess.STDOUT).decode('utf-8')
+ except subprocess.CalledProcessError as e:
return None
- foss_output = unicode(foss_output, "utf-8")
foss_output = string.replace(foss_output, '\r', '')
# Package info