diff options
author | Adam Spiers <git@adamspiers.org> | 2018-05-16 16:12:34 +0100 |
---|---|---|
committer | Adam Spiers <git@adamspiers.org> | 2018-05-16 16:25:24 +0100 |
commit | 2446d4a6061b65c498b4ad78b507e640553f08f8 (patch) | |
tree | 798d4341f2361fa3eeef47f8187ff812d9e5bba7 /git_deps/gitutils.py | |
parent | 09bd07f2b86fd14008791cbf0543d533cc7aa57d (diff) | |
download | git-deps-2446d4a6061b65c498b4ad78b507e640553f08f8.tar.gz |
fix Python 3 uses of subprocess.check_output
https://stackoverflow.com/questions/15817420/subprocess-and-type-str-doesnt-support-the-buffer-api/15817457#15817457
Diffstat (limited to 'git_deps/gitutils.py')
-rw-r--r-- | git_deps/gitutils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/git_deps/gitutils.py b/git_deps/gitutils.py index f7b5470..f699551 100644 --- a/git_deps/gitutils.py +++ b/git_deps/gitutils.py @@ -15,7 +15,7 @@ class GitUtils(object): # we will be able to do this via pygit2. cmd = ['git', 'rev-parse', '--short', sha1] # cls.logger.debug(" ".join(cmd)) - out = subprocess.check_output(cmd).strip() + out = subprocess.check_output(cmd, universal_newlines=True).strip() # cls.logger.debug(out) return out @@ -39,7 +39,8 @@ class GitUtils(object): # cls.logger.debug(" ".join(cmd)) out = None try: - out = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + out = subprocess.check_output( + cmd, stderr=subprocess.STDOUT, universal_newlines=True) except subprocess.CalledProcessError as e: if e.output.find('No tags can describe') != -1: return '' @@ -77,7 +78,8 @@ class GitUtils(object): @classmethod def rev_list(cls, rev_range): cmd = ['git', 'rev-list', rev_range] - return subprocess.check_output(cmd).strip().split('\n') + return subprocess.check_output(cmd, universal_newlines=True) \ + .strip().split('\n') @classmethod def ref_commit(cls, repo, rev): |