Skip to content

Commit

Permalink
MAINT: Use check_output when merging.
Browse files Browse the repository at this point in the history
Since we don't support Python 2.6 anymore, the `check_output` method
from `subprocess` is  at our disposal.    Follow-up to #14447.    xref
<a href="https://github.com/pandas-
dev/pandas/issues/14439#issuecomment-254522055"> #14439 (comment)</a>

Author: gfyoung <gfyoung17@gmail.com>

Closes #14465 from gfyoung/merge-pr-refactor and squashes the following commits:

e267d2b [gfyoung] MAINT: Use check_output when merging.
  • Loading branch information
gfyoung authored and jreback committed Oct 24, 2016
1 parent 233d51d commit 8f54e35
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions scripts/merge-py.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

from __future__ import print_function

from subprocess import check_output
from requests.auth import HTTPBasicAuth
import requests

import os
import six
import subprocess
import sys
import textwrap

Expand Down Expand Up @@ -83,21 +83,10 @@ def fail(msg):


def run_cmd(cmd):
# py2.6 does not have subprocess.check_output
if isinstance(cmd, six.string_types):
cmd = cmd.split(' ')

popenargs = [cmd]
kwargs = {}

process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
raise subprocess.CalledProcessError(retcode, cmd, output=output)
output = check_output(cmd)

if isinstance(output, six.binary_type):
output = output.decode('utf-8')
Expand Down

0 comments on commit 8f54e35

Please sign in to comment.