Skip to content

Commit 67c1612

Browse files
committed
Use built-in check_output (mostly)
Replace one check_output to check_call since we don't use the output.
1 parent 8a3009b commit 67c1612

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

setup.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from distutils.spawn import find_executable
1515
from distutils import log
1616
from platform import architecture
17-
from subprocess import Popen, CalledProcessError, PIPE, check_call
17+
from subprocess import check_output, check_call
1818
from glob import glob
1919
import fnmatch
2020
import sys
@@ -179,7 +179,7 @@ def build_extension(self, ext):
179179
interop_file = _get_interop_filename()
180180
if not os.path.exists(interop_file):
181181
geninterop = os.path.join("tools", "geninterop", "geninterop.py")
182-
_check_output([sys.executable, geninterop, interop_file])
182+
check_call([sys.executable, geninterop, interop_file])
183183

184184
cmd = [
185185
_xbuild,
@@ -285,18 +285,9 @@ def run(self):
285285
return install_data.run(self)
286286

287287

288-
def _check_output(*popenargs, **kwargs):
289-
"""subprocess.check_output from python 2.7.
290-
Added here to support building for earlier versions of Python.
291-
"""
292-
process = Popen(stdout=PIPE, *popenargs, **kwargs)
293-
output, unused_err = process.communicate()
294-
retcode = process.poll()
295-
if retcode:
296-
cmd = kwargs.get("args")
297-
if cmd is None:
298-
cmd = popenargs[0]
299-
raise CalledProcessError(retcode, cmd, output=output)
288+
def _check_output(*args, **kwargs):
289+
"""Check output wrapper for py2/py3 compatibility"""
290+
output = check_output(*args, **kwargs)
300291
if sys.version_info[0] > 2:
301292
return output.decode("ascii")
302293
return output

0 commit comments

Comments
 (0)