Merge "Improve python 3 compatibility"

This commit is contained in:
Jenkins 2015-07-27 06:33:51 +00:00 committed by Gerrit Code Review
commit e16235f9bd
2 changed files with 26 additions and 10 deletions

View File

@ -342,7 +342,9 @@ def www_touched():
try: try:
git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"] git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = subprocess.check_output(git_args).strip().split() modified_files = subprocess.check_output(
git_args,
universal_newlines=True).strip().split()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)
@ -363,7 +365,9 @@ def only_po_touched():
try: try:
git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"] git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = subprocess.check_output(git_args).strip().split() modified_files = subprocess.check_output(
git_args,
universal_newlines=True).strip().split()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)
@ -384,7 +388,9 @@ def only_rst_touched():
try: try:
git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"] git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = subprocess.check_output(git_args).strip().split() modified_files = subprocess.check_output(
git_args,
universal_newlines=True).strip().split()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)
@ -411,7 +417,9 @@ def check_modified_affects_all(rootdir):
try: try:
git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"] git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = subprocess.check_output(git_args).strip().split() modified_files = subprocess.check_output(
git_args,
universal_newlines=True).strip().split()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)
@ -445,7 +453,9 @@ def get_modified_files(rootdir, filtering=None):
"HEAD"] "HEAD"]
if filtering is not None: if filtering is not None:
git_args.append(filtering) git_args.append(filtering)
modified_files = subprocess.check_output(git_args).strip().split() modified_files = subprocess.check_output(
git_args,
universal_newlines=True).strip().split()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)
@ -763,11 +773,11 @@ def get_gitroot():
try: try:
git_args = ["git", "rev-parse", "--show-toplevel"] git_args = ["git", "rev-parse", "--show-toplevel"]
gitroot = subprocess.check_output(git_args).rstrip() gitroot = subprocess.check_output(git_args,
universal_newlines=True).rstrip()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)
return gitroot return gitroot
@ -776,11 +786,14 @@ def print_gitinfo():
try: try:
git_cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"] git_cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
gitbranch = subprocess.check_output(git_cmd).rstrip() gitbranch = subprocess.check_output(git_cmd,
universal_newlines=True).rstrip()
git_cmd = ["git", "show", "--format=%s", "-s"] git_cmd = ["git", "show", "--format=%s", "-s"]
gitsubject = subprocess.check_output(git_cmd).rstrip() gitsubject = subprocess.check_output(git_cmd,
universal_newlines=True).rstrip()
git_cmd = ["git", "show", "--format=%an", "-s"] git_cmd = ["git", "show", "--format=%an", "-s"]
gitauthor = subprocess.check_output(git_cmd).rstrip() gitauthor = subprocess.check_output(git_cmd,
universal_newlines=True).rstrip()
except (subprocess.CalledProcessError, OSError) as e: except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e) print("git failed: %s" % e)
sys.exit(1) sys.exit(1)

View File

@ -15,6 +15,9 @@ classifier =
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 2 Programming Language :: Python :: 2
Programming Language :: Python :: 2.7 Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
[files] [files]
packages = packages =