[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core] [PATCH 1/1] generate-manifest-2.7.py: replace os.popen with os.unlink
From:       liezhi.yang () windriver ! com (Robert Yang)
Date:       2012-05-31 8:08:50
Message-ID: 03e343fe959dd5dea32882fbe34edd5bcc417fee.1338429495.git.liezhi.yang () windriver ! com
[Download RAW message or body]

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 at windriver.com>
---
 scripts/contrib/python/generate-manifest-2.7.py |    5 ++++-
 1 files changed, 4 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..5c52724 100755
--- a/scripts/contrib/python/generate-manifest-2.7.py
+++ b/scripts/contrib/python/generate-manifest-2.7.py
@@ -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
-- 
1.7.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic