diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2012-05-20 20:36:05 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-23 11:35:11 +0100 |
commit | 10a0f9ed929449543e5caab7e5f8855e0e68605b (patch) | |
tree | 906283ad2b35380b2240854f120eb646f51c8fab /bitbake/lib/bb | |
parent | 358016f463958640c694d031a481264a0e770802 (diff) | |
download | poky-10a0f9ed929449543e5caab7e5f8855e0e68605b.tar.gz |
replace os.system with subprocess.call
Replace os.system with subprocess.call since the older function would
fail (more or less) silently if the executed program cannot be found
More info:
http://docs.python.org/library/subprocess.html#subprocess-replacements
[YOCTO #2075]
(Bitbake rev: f5b3bf115dc1ffbfb241a49cec0fc3654cb71021)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch2/perforce.py | 3 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index cbdc84853c..6abf15d65a 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py | |||
@@ -27,6 +27,7 @@ BitBake build tools. | |||
27 | 27 | ||
28 | from future_builtins import zip | 28 | from future_builtins import zip |
29 | import os | 29 | import os |
30 | import subprocess | ||
30 | import logging | 31 | import logging |
31 | import bb | 32 | import bb |
32 | from bb import data | 33 | from bb import data |
@@ -184,7 +185,7 @@ class Perforce(FetchMethod): | |||
184 | dest = list[0][len(path)+1:] | 185 | dest = list[0][len(path)+1:] |
185 | where = dest.find("#") | 186 | where = dest.find("#") |
186 | 187 | ||
187 | os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module, dest[:where], list[0])) | 188 | subprocess.call("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module, dest[:where], list[0]), shell=True) |
188 | count = count + 1 | 189 | count = count + 1 |
189 | 190 | ||
190 | if count == 0: | 191 | if count == 0: |
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py index 153837611f..5d8549170c 100755 --- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py +++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py | |||
@@ -25,6 +25,7 @@ import gtk | |||
25 | from bb.ui.crumbs.hobcolor import HobColors | 25 | from bb.ui.crumbs.hobcolor import HobColors |
26 | from bb.ui.crumbs.hobwidget import hic, HobViewTable, HobAltButton, HobButton | 26 | from bb.ui.crumbs.hobwidget import hic, HobViewTable, HobAltButton, HobButton |
27 | from bb.ui.crumbs.hobpages import HobPage | 27 | from bb.ui.crumbs.hobpages import HobPage |
28 | import subprocess | ||
28 | 29 | ||
29 | # | 30 | # |
30 | # ImageDetailsPage | 31 | # ImageDetailsPage |
@@ -297,7 +298,7 @@ class ImageDetailsPage (HobPage): | |||
297 | self.show_all() | 298 | self.show_all() |
298 | 299 | ||
299 | def view_files_clicked_cb(self, button, image_addr): | 300 | def view_files_clicked_cb(self, button, image_addr): |
300 | os.system("xdg-open /%s" % image_addr) | 301 | subprocess.call("xdg-open /%s" % image_addr, shell=True) |
301 | 302 | ||
302 | def refresh_package_detail_box(self, image_size): | 303 | def refresh_package_detail_box(self, image_size): |
303 | self.package_detail.update_line_widgets("Total image size: ", image_size) | 304 | self.package_detail.update_line_widgets("Total image size: ", image_size) |
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 8524446d22..1425bbd263 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | from __future__ import division | 48 | from __future__ import division |
49 | import logging | 49 | import logging |
50 | import os, sys, curses, itertools, time | 50 | import os, sys, curses, itertools, time, subprocess |
51 | import bb | 51 | import bb |
52 | import xmlrpclib | 52 | import xmlrpclib |
53 | from bb import ui | 53 | from bb import ui |
@@ -286,7 +286,7 @@ class NCursesUI: | |||
286 | # bb.error("log data follows (%s)" % logfile) | 286 | # bb.error("log data follows (%s)" % logfile) |
287 | # number_of_lines = data.getVar("BBINCLUDELOGS_LINES", d) | 287 | # number_of_lines = data.getVar("BBINCLUDELOGS_LINES", d) |
288 | # if number_of_lines: | 288 | # if number_of_lines: |
289 | # os.system('tail -n%s %s' % (number_of_lines, logfile)) | 289 | # subprocess.call('tail -n%s %s' % (number_of_lines, logfile), shell=True) |
290 | # else: | 290 | # else: |
291 | # f = open(logfile, "r") | 291 | # f = open(logfile, "r") |
292 | # while True: | 292 | # while True: |