diff options
author | 2019-12-14 23:18:15 -0800 | |
---|---|---|
committer | 2019-12-14 23:18:15 -0800 | |
commit | d26d352ade725d3d6cc6feb22c7935bb9355509a (patch) | |
tree | 4be6f3bd5a838c76686fa3687419587e343d825d | |
parent | local: tag files to trace remaining cfengine usage (diff) | |
download | githooks-d26d352ade725d3d6cc6feb22c7935bb9355509a.tar.gz githooks-d26d352ade725d3d6cc6feb22c7935bb9355509a.tar.bz2 githooks-d26d352ade725d3d6cc6feb22c7935bb9355509a.zip |
pre-receive.gentoo-news: fix bytes encoding
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rwxr-xr-x | local/git.gentoo.org/pre-receive.gentoo-news | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/local/git.gentoo.org/pre-receive.gentoo-news b/local/git.gentoo.org/pre-receive.gentoo-news index e8ba411..2285310 100755 --- a/local/git.gentoo.org/pre-receive.gentoo-news +++ b/local/git.gentoo.org/pre-receive.gentoo-news @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # gentoo-infra: infra/githooks.git:local/git.gentoo.org/pre-receive.gentoo-news # vim:fileencoding=utf-8 et st=4 sts=4 -# Copyright 2012-2014 Gentoo Foundation +# Copyright 2012-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # $Id$ @@ -31,6 +31,8 @@ def main(prog, *argv): return '%s: GIT_DIR unset' % (prog, ) results = [] for line in fileinput.input(): + if isinstance(line, bytes): + line = line.decode() # <old-value> SP <new-value> SP <ref-name> LF (oldrev, newrev, refname) = line.split() results += [validate(oldrev, newrev, refname)] @@ -53,7 +55,10 @@ def validate(oldrev, newrev, refname): '--name-only', '--diff-filter=A', \ '%s..%s' % (oldrev, newrev)], stdout=subprocess.PIPE) - added = proc.communicate()[0].rstrip().split('\n') + added = proc.communicate()[0] + if isinstance(added, bytes): + added = added.decode() + added = added.rstrip().split('\n') for filename in [f for f in added if len(f) > 0]: # GLEP 42: name should take the form of: |