|
14 | 14 | from distutils.spawn import find_executable
|
15 | 15 | from distutils import log
|
16 | 16 | from platform import architecture
|
17 |
| -from subprocess import Popen, CalledProcessError, PIPE, check_call |
| 17 | +from subprocess import check_output, check_call |
18 | 18 | from glob import glob
|
19 | 19 | import fnmatch
|
20 | 20 | import sys
|
@@ -179,7 +179,7 @@ def build_extension(self, ext):
|
179 | 179 | interop_file = _get_interop_filename()
|
180 | 180 | if not os.path.exists(interop_file):
|
181 | 181 | geninterop = os.path.join("tools", "geninterop", "geninterop.py")
|
182 |
| - _check_output([sys.executable, geninterop, interop_file]) |
| 182 | + check_call([sys.executable, geninterop, interop_file]) |
183 | 183 |
|
184 | 184 | cmd = [
|
185 | 185 | _xbuild,
|
@@ -285,18 +285,9 @@ def run(self):
|
285 | 285 | return install_data.run(self)
|
286 | 286 |
|
287 | 287 |
|
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) |
300 | 291 | if sys.version_info[0] > 2:
|
301 | 292 | return output.decode("ascii")
|
302 | 293 | return output
|
|
0 commit comments