kernel.py: replace os.popen with subprocess.Popen
cover kernel.py: replace os.popen with subprocess.Popen
Note: This is only for yocto, not for oe-core, since oe-core doesn't have scripts/lib/bsp/kernel.py.
// Robert
The following changes since commit de4cdfd6bc1280ac7ac0559b87734d26294ef773:
documentation/kernel-manual/kernel-how-to.xml: Updated to kernel 3.4 (2012-05-31 21:16:55 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/kernel_py
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/kernel_py
Robert Yang (1):
kernel.py: replace os.popen with subprocess.Popen
scripts/lib/bsp/kernel.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
PATCH 1/1 kernel.py: replace os.popen with subprocess.Popen
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]
--- scripts/lib/bsp/kernel.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
scripts/lib/bsp/kernel.py +3 -2
@@ -31,6 +31,7 @@ import os import shutil from tags import * import glob +import subprocess def find_bblayers(scripts_path):
@@ -678,7 +679,7 @@ def base_branches(context): print "Getting branches from remote repo %s..." % giturl gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp = os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read() branches = []
@@ -708,7 +709,7 @@ def all_branches(context): print "Getting branches from remote repo %s..." % giturl gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp = os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read() branches = []
Signature · 1 line
1.7.1
Quoted 26 lines · Robert Yang
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 <[email protected]>--- scripts/lib/bsp/kernel.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)scripts/lib/bsp/kernel.py +1
-0@@ -31,6 +31,7 @@ import os import shutil from tags import * import glob +import subprocess def find_bblayers(scripts_path):
scripts/lib/bsp/kernel.py def base_branches(context): · line 682
Quoted 5 lines
scripts/lib/bsp/kernel.py +1
-1@@ -678,7 +679,7 @@ def base_branches(context): print "Getting branches from remote repo %s..." % giturl gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp = os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read()
Subprocess is right module to use here, but I believe the recommended method would be:
subprocess.call(gitcmd...
According to:
http://docs.python.org/library/subprocess.html
scripts/lib/bsp/kernel.py def all_branches(context): · line 715
Quoted 12 lines
scripts/lib/bsp/kernel.py +1
-1branches = []@@ -708,7 +709,7 @@ def all_branches(context): print "Getting branches from remote repo %s..." % giturl gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp = os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read() branches = []
And here I think subprocess.check_output(...) is preferred.
Signature · 3 lines
Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel
Quoted 49 lines · Darren Hart
Quoted 26 lines · Robert Yang
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 <[email protected]>--- scripts/lib/bsp/kernel.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)scripts/lib/bsp/kernel.py +1
-0@@ -31,6 +31,7 @@ import os import shutil from tags import * import glob +import subprocess def find_bblayers(scripts_path):scripts/lib/bsp/kernel.py def base_branches(context): · line 682
Quoted 5 lines
scripts/lib/bsp/kernel.py +1
-1@@ -678,7 +679,7 @@ def base_branches(context): print "Getting branches from remote repo %s..." % giturl gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp = os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read()Subprocess is right module to use here, but I believe the recommended method would be:
subprocess.call(gitcmd...
According to:
http://docs.python.org/library/subprocess.htmlQuoted 6 lines
scripts/lib/bsp/kernel.py +0
-0branches = []@@ -708,7 +709,7 @@ def all_branches(context): print "Getting branches from remote repo %s..." % giturl
Quoted 8 lines
scripts/lib/bsp/kernel.py def base_branches(context): · line 685
Quoted 6 lines
scripts/lib/bsp/kernel.py +1
-1gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp = os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read() branches = []And here I think
subprocess.check_output(...)is preferred.
That's only in python 2.7 and newer, are distros with python-2.6 unsupported now?
I did the same mistake in opkg-utils (patch for it is on yocto ML).
https://lists.yoctoproject.org/pipermail/yocto/2012-May/009182.html
Cheers,
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 8 lines · Martin Jansa
Quoted 7 lines · Darren Hart
Quoted 4 lines · Robert Yang
Replace os.popen with subprocess.Popen since the older function would fail (more or less) silently if the executed program cannot be found
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
More info:
http://docs.python.org/library/subprocess.html#subprocess-replacements
[YOCTO #2454]
Quoted 42 lines
Quoted 33 lines
Quoted 12 lines
Signed-off-by Robert Yang <[email protected]> ---
scripts/lib/bsp/kernel.py| 5 +++-- 1 files changed, 3
insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/scripts/lib/bsp/kernel.pyindex 8b3aa72..7c6da4e 100644 ---a/scripts/lib/bsp/kernel.py+++b/scripts/lib/bsp/kernel.py@@ -31,6 +31,7 @@ import os import shutil from tags import * import glob +import subprocessQuoted 7 lines
def
find_bblayers(scripts_path): @@ -678,7 +679,7 @@ defbase_branches(context): print "Getting branches from remote repo %s..." % giturlgitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp =
os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd,
shell=True, stdout=subprocess.PIPE).stdout.read()Subprocess is right module to use here, but I believe the recommended method would be:
subprocess.call(gitcmd...
According to: http://docs.python.org/library/subprocess.html
Quoted 6 lines
branches = []
(quoted diff) +0
-0@@ -708,7 +709,7 @@ def all_branches(context): print "Gettingbranches from remote repo %s..." % giturl
Quoted 8 lines
Quoted 6 lines
gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) - tmp =
os.popen(gitcmd).read() + tmp = subprocess.Popen(gitcmd,
shell=True, stdout=subprocess.PIPE).stdout.read()branches = []
And here I think
subprocess.check_output(...)is preferred.
Quoted 6 lines
That's only in python 2.7 and newer, are distros with python-2.6 unsupported now?
I did the same mistake in opkg-utils (patch for it is on yocto ML).
https://lists.yoctoproject.org/pipermail/yocto/2012-May/009182.html
Ah,
Quoted 1 line
thanks for catching that. What is the minimum python requirement?
I thought we had something in place to allow for older distributions to work with more modern python syntax.
- --
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJP0hyPAAoJEKbMaAwKp364hJAIAJ3w30/C6dJoGzCpy14qVZtq 3EouInWZEjIkckztbbkrh9LCJbU8WEiGFd1/yXFlG8TpApF7FPmjY89uDVN7seai Mh9sKzrCIbkS2R1pT8/Ubr7RWL+YGIs4a1hVQbxqZA4PCLPKpxmIe5fDcVBaVm9B k3p328RM0ff5ycos414T4hTcjf3//yI36LESFCBuj133veUwhStwdtDjuz5aMEVj G4TG3SWlPymD0L4hrcMaWyjv7d69BydcKbQm20OOnqVz1BqsS6zlVrCjwPlgq2oe rNqvb96YAWwbReKvPuKXMQmQOaYRubMk9lkXJYrA2+6Z7sV+S5Lu41/yne6pBDY= =9TgZ
-----END PGP SIGNATURE-----
Quoted 12 lines · Darren Hart
Quoted 9 lines · Martin Jansa
Quoted 1 line · Darren Hart
And here I think
subprocess.check_output(...)is preferred.That's only in python 2.7 and newer, are distros with python-2.6 unsupported now?
I did the same mistake in opkg-utils (patch for it is on yocto ML).
https://lists.yoctoproject.org/pipermail/yocto/2012-May/009182.html
Quoted 6 lines
Ah,
Quoted 1 line
thanks for catching that. What is the minimum python requirement?
I thought we had something in place to allow for older distributions to work with more modern python syntax.
We have the option of the external python tarball but we only resort to that for really old systems. Our minimum python version is currently 2.6 and whilst there are some benefits from 2.7 (such as the process stuff), we've not seen enough to warrant switching at this point. We have workarounds in place for the process pieces.
Cheers,
Richard
Flanagan, Elizabeth
AppliedQuoted 16 lines · Robert Yang
Note: This is only for yocto, not for oe-core, since oe-core doesn't have
scripts/lib/bsp/kernel.py.// Robert
The following changes since commit
de4cdfd6bc1280ac7ac0559b87734d26294ef773:documentation/kernel-manual/kernel-how-to.xml: Updated to kernel 3.4 (2012-05-31 21:16:55 +0100)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/kernel_py
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/kernel_pyRobert Yang (1):
kernel.py: replace os.popen with subprocess.Popen
Quoted 7 lines
scripts/lib/bsp/kernel.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)_______________________________________________
poky mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/poky
Merged into Poky
Thanks
-b
Signature · 3 lines
Elizabeth Flanagan Yocto Project Build and Release