generate-manifest-2.7.py: replace os.popen with os.unlink

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]

(From OE-Core rev: bc9f7d7b7eda1c45ad1aaee469ebe28ee1c0c96b)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang 2012-05-30 17:18:15 +08:00 committed by Richard Purdie
parent d068a7577c
commit 09a7dc9a46
1 changed files with 4 additions and 1 deletions

View File

@ -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