On Mon, 2015-11-09 at 09:33 -0500, Kevin O'Connor wrote:
Don't require python2.7 in buildversion.py. Also, ignore only those exceptions that are known to be possible.
Signed-off-by: Kevin O'Connor kevin@koconnor.net
scripts/buildversion.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/scripts/buildversion.py b/scripts/buildversion.py index d61fc9e..5b8807e 100755 --- a/scripts/buildversion.py +++ b/scripts/buildversion.py @@ -4,7 +4,7 @@ # Copyright (C) 2015 Kevin O'Connor kevin@koconnor.net # # This file may be distributed under the terms of the GNU GPLv3 license. -import sys, os, subprocess, time, socket, optparse +import sys, os, subprocess, shlex, time, socket, optparse VERSION_FORMAT = """ /* DO NOT EDIT! This is an autogenerated file. See scripts/buildversion.py. */ @@ -12,16 +12,24 @@ VERSION_FORMAT = """ #define BUILD_TOOLS "%s" """ +# Run program and return the specified output +def check_output(prog): + try: + process = subprocess.Popen(shlex.split(prog), stdout=subprocess.PIPE)
I suppose the old code has the same behaviour, but are you aware of: http:// www.chiark.greenend.org.uk/~cjwatson/blog/python-sigpipe.html ? (tl;dr: One may need to reset SIGPIPE in the child)