summaryrefslogtreecommitdiffstats
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-10-01 21:45:56 +0100
commit5d96223e312fe8276ab9684e13cb2af41536e48a (patch)
treec82c83b59a141ee3ce006647df8634574cc25189 /meta/classes/spdx.bbclass
parent1ab3a237397663cdbffc914b51f086682623c4a3 (diff)
downloadpoky-5d96223e312fe8276ab9684e13cb2af41536e48a.tar.gz
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 ] (From OE-Core rev: 0d6b7276003f1afabc6de683f663540327d52bdc) 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):
219def run_fossology(foss_command, full_spdx): 219def run_fossology(foss_command, full_spdx):
220 import string, re 220 import string, re
221 import subprocess 221 import subprocess
222 222
223 p = subprocess.Popen(foss_command.split(), 223 try:
224 stdout=subprocess.PIPE, stderr=subprocess.PIPE) 224 foss_output = subprocess.check_output(foss_command.split(),
225 foss_output, foss_error = p.communicate() 225 stderr=subprocess.STDOUT).decode('utf-8')
226 if p.returncode != 0: 226 except subprocess.CalledProcessError as e:
227 return None 227 return None
228 228
229 foss_output = unicode(foss_output, "utf-8")
230 foss_output = string.replace(foss_output, '\r', '') 229 foss_output = string.replace(foss_output, '\r', '')
231 230
232 # Package info 231 # Package info