[OE-core] [PATCH 4/4] scripts: replace os.popen with subprocess.Popen

Robert Yang liezhi.yang at windriver.com
Tue May 29 14:53:09 UTC 2012


Replace os.popen with subprocess.Popen 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 #2454]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 scripts/contrib/python/generate-manifest-2.7.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/contrib/python/generate-manifest-2.7.py b/scripts/contrib/python/generate-manifest-2.7.py
index 7b43137..d139ab1 100755
--- a/scripts/contrib/python/generate-manifest-2.7.py
+++ b/scripts/contrib/python/generate-manifest-2.7.py
@@ -13,6 +13,7 @@
 import os
 import sys
 import time
+import subprocess
 
 VERSION = "2.7.2"
 
@@ -149,7 +150,7 @@ class MakefileMaker:
 if __name__ == "__main__":
 
     if len( sys.argv ) > 1:
-        os.popen( "rm -f ./%s" % sys.argv[1] )
+        subprocess.Popen("rm -f ./%s" % sys.argv[1], shell=True, stdout=subprocess.PIPE).stdout
         outfile = file( sys.argv[1], "w" )
     else:
         outfile = sys.stdout
-- 
1.7.1





More information about the Openembedded-core mailing list