Skip to content
Prev Previous commit
Next Next commit
Readded the 2.6 backport but I can't get this OR the original to run …
…in 2.6
  • Loading branch information
Jwink3101 committed Sep 12, 2019
commit 2f6c8c6e78c9f73355c6b4f2c2a1349bbe947e5f
30 changes: 27 additions & 3 deletions git-fat
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,39 @@ import threading
import time
import collections

# if not type(sys.version_info) is tuple and sys.version_info.major > 2:
# sys.stderr.write('git-fat does not support Python-3 yet. Please use python2.\n')
# sys.exit(1)

if sys.version_info[0] > 2:
unicode = str
else:
from io import open

try:
from subprocess import check_output
del check_output
except ImportError:
def backport_check_output(*popenargs, **kwargs):
r"""Run command with arguments and return its output as a byte string.

Backported from Python 2.7 as it's implemented as pure python on stdlib.

>>> check_output(['/usr/bin/python', '--version'])
Python 2.6.2
"""
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
output, unused_err = process.communicate()
retcode = process.poll()
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
error = subprocess.CalledProcessError(retcode, cmd)
error.output = output
raise error
return output

subprocess.check_output = backport_check_output


BLOCK_SIZE = 4096

def uni(s,encoding='utf8'):
Expand Down