]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
replace os.system with subprocess.call
authorRobert Yang <liezhi.yang@windriver.com>
Sun, 20 May 2012 12:36:05 +0000 (20:36 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 23 May 2012 10:35:11 +0000 (11:35 +0100)
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>
bitbake/lib/bb/fetch2/perforce.py
bitbake/lib/bb/ui/crumbs/imagedetailspage.py
bitbake/lib/bb/ui/ncurses.py

index cbdc84853cbc4dd1608b5e2d7b168171a08e3dbe..6abf15d65a2c7f076a234dfef9b1cc59d2238aaf 100644 (file)
@@ -27,6 +27,7 @@ BitBake build tools.
 
 from future_builtins import zip
 import os
+import subprocess
 import logging
 import bb
 from   bb import data
@@ -184,7 +185,7 @@ class Perforce(FetchMethod):
             dest = list[0][len(path)+1:]
             where = dest.find("#")
 
-            os.system("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module, dest[:where], list[0]))
+            subprocess.call("%s%s print -o %s/%s %s" % (p4cmd, p4opt, module, dest[:where], list[0]), shell=True)
             count = count + 1
 
         if count == 0:
index 153837611f94171a5c3271ea9557f21c8a01e879..5d8549170c10950b33f0b21ec8efb50e65b6b70d 100755 (executable)
@@ -25,6 +25,7 @@ import gtk
 from bb.ui.crumbs.hobcolor import HobColors
 from bb.ui.crumbs.hobwidget import hic, HobViewTable, HobAltButton, HobButton
 from bb.ui.crumbs.hobpages import HobPage
+import subprocess
 
 #
 # ImageDetailsPage
@@ -297,7 +298,7 @@ class ImageDetailsPage (HobPage):
         self.show_all()
 
     def view_files_clicked_cb(self, button, image_addr):
-        os.system("xdg-open /%s" % image_addr)
+        subprocess.call("xdg-open /%s" % image_addr, shell=True)
 
     def refresh_package_detail_box(self, image_size):
         self.package_detail.update_line_widgets("Total image size: ", image_size)
index 8524446d22f389f42d0472079b9eb0e6bcb9fe6c..1425bbd263e81d51cd0537c3e0a1182f8eda8f6e 100644 (file)
@@ -47,7 +47,7 @@
 
 from __future__ import division
 import logging
-import os, sys, curses, itertools, time
+import os, sys, curses, itertools, time, subprocess
 import bb
 import xmlrpclib
 from bb import ui
@@ -286,7 +286,7 @@ class NCursesUI:
 #                            bb.error("log data follows (%s)" % logfile)
 #                            number_of_lines = data.getVar("BBINCLUDELOGS_LINES", d)
 #                            if number_of_lines:
-#                                os.system('tail -n%s %s' % (number_of_lines, logfile))
+#                                subprocess.call('tail -n%s %s' % (number_of_lines, logfile), shell=True)
 #                            else:
 #                                f = open(logfile, "r")
 #                                while True: