Skip to contentSkip to conversation

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

PATCH Applied Robert Yang 2 participants 3 messages May 31, 2012 – Jun 11, 2012

lore
Share & tools
lore
#0 lore raw

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

The following changes since commit 348da93e283b2b8454fd9cde80d4b17378e2a168:

webkit-gtk: Use glib as unicode backend to avoid browser crash (2012-05-30 17:38:02 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/gen_man_py
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/gen_man_py

Robert Yang (1):
generate-manifest-2.7.py: replace os.popen with os.unlink

 scripts/contrib/python/generate-manifest-2.7.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
#1 lore raw

PATCH 1/1 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]

---
 scripts/contrib/python/generate-manifest-2.7.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
scripts/contrib/python/generate-manifest-2.7.py +4 -1
index 7b43137..5c52724 100755
@@ -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
Signature · 1 line
1.7.1
#2 lore raw
In reply to Robert Yang
Quoted 11 lines · Robert Yang

The following changes since commit 348da93e283b2b8454fd9cde80d4b17378e2a168:

 webkit-gtk: Use glib as unicode backend to avoid browser crash (2012-05-30 17:38:02 +0100)

are available in the git repository at:
 git://git.pokylinux.org/poky-contrib robert/gen_man_py
 http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/gen_man_py

Robert Yang (1):
 generate-manifest-2.7.py: replace os.popen with os.unlink

Quoted 8 lines

 scripts/contrib/python/generate-manifest-2.7.py |    5 ++++-

 1 files changed, 4 insertions(+), 1 deletions(-)

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Merged into OE-Core

Thanks

-b

Signature · 3 lines
Elizabeth Flanagan
Yocto Project
Build and Release