From d0afd377096c1e6e2980ebf075a39d1aeb7e7c79 Mon Sep 17 00:00:00 2001 From: Akemi Date: Mon, 12 Feb 2018 19:18:11 +0100 Subject: build: fix swift detection with python2 c82fed8 fixed the detection with python3 but broke it on python2. the decode function on python2 converts the str to unicode which causes problems when concatenating to str when building. instead of decoding the output we change the subprocess to operate in text mode. also use check_output instead of Popen for simplicity. --- waftools/detections/compiler_swift.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py index c1fe06117a..01349e820d 100644 --- a/waftools/detections/compiler_swift.py +++ b/waftools/detections/compiler_swift.py @@ -2,12 +2,8 @@ from waflib import Utils def __run(cmd): try: - cmd = Utils.subprocess.Popen(cmd, - stdout=Utils.subprocess.PIPE, - stderr=Utils.subprocess.PIPE, - shell=True) - output = cmd.stdout.read().decode().strip() - return output + output = Utils.subprocess.check_output(cmd, universal_newlines=True, shell=True) + return output.strip() except Exception: return "" -- cgit v1.2.3