]> code.ossystems Code Review - openembedded-core.git/commitdiff
generate-manifest-2.7.py: replace os.popen with os.unlink
authorRobert Yang <liezhi.yang@windriver.com>
Wed, 30 May 2012 09:18:15 +0000 (17:18 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 5 Jun 2012 21:54:20 +0000 (22:54 +0100)
The os.popen function would fail (more or less) silently if the executed
program cannot be found, and here what we need is os.system not os.popen
since it doesn't use the return value, use os.unlink() and ignore
exceptions from it would be better as Chris suggested.

[YOCTO #2454]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
scripts/contrib/python/generate-manifest-2.7.py

index 7b43137bd8f5ae435924adc6732a83aeb61a9e99..5c527241e75aa47927c2c69629e3db8ff0a61095 100755 (executable)
@@ -149,7 +149,10 @@ class MakefileMaker:
 if __name__ == "__main__":
 
     if len( sys.argv ) > 1:
-        os.popen( "rm -f ./%s" % sys.argv[1] )
+        try:
+            os.unlink(sys.argv[1])
+        except Exception:
+            sys.exc_clear()
         outfile = file( sys.argv[1], "w" )
     else:
         outfile = sys.stdout