From 31993b09eca49135642bc505065bb8105798e3ad Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Thu, 5 May 2016 06:36:08 +1000 Subject: [PATCH] Replaced os.system with subprocess.call --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 144c273ee..7ce2ebd0e 100644 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ import platform as plat import re import struct import sys +import subprocess from distutils.command.build_ext import build_ext from distutils import sysconfig @@ -238,7 +239,6 @@ class pil_build_ext(build_ext): _add_directory(include_dirs, "/opt/local/include") # if Homebrew is installed, use its lib and include directories - import subprocess try: prefix = subprocess.check_output(['brew', '--prefix']).strip( ).decode('latin1') @@ -763,9 +763,9 @@ class pil_build_ext(build_ext): tmpfile = os.path.join(self.build_temp, 'multiarch') if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) - ret = os.system( - 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' % - tmpfile) + with open(tmpfile, 'wb') as fp: + ret = subprocess.call([ + 'dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=fp) try: if ret >> 8 == 0: fp = open(tmpfile, 'r')