You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/06/07 16:30:32 UTC

[2/2] mesos git commit: Fixed type error when using `check_output` in Python 3 scripts.

Fixed type error when using `check_output` in Python 3 scripts.

Review: https://reviews.apache.org/r/67463/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d05c8cad
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d05c8cad
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d05c8cad

Branch: refs/heads/master
Commit: d05c8cad7e6d0f9d86790f0cf3a81568e122b61a
Parents: a170360
Author: Armand Grillet <ag...@mesosphere.io>
Authored: Thu Jun 7 09:29:36 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Thu Jun 7 09:30:06 2018 -0700

----------------------------------------------------------------------
 support/python3/generate-endpoint-help.py |  4 +++-
 support/python3/mesos-gtest-runner.py     |  2 +-
 support/python3/push-commits.py           | 20 +++++++++++---------
 3 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d05c8cad/support/python3/generate-endpoint-help.py
----------------------------------------------------------------------
diff --git a/support/python3/generate-endpoint-help.py b/support/python3/generate-endpoint-help.py
index 711d3d3..43bf3b0 100755
--- a/support/python3/generate-endpoint-help.py
+++ b/support/python3/generate-endpoint-help.py
@@ -94,7 +94,9 @@ class Subprocess(object):
 
 # A pointer to the top level directory of the mesos project.
 GIT_TOP_DIR = subprocess.check_output(
-    ['git', 'rev-parse', '--show-cdup']).strip()
+    ['git',
+     'rev-parse',
+     '--show-cdup']).decode(sys.stdout.encoding).strip()
 
 with open(os.path.join(GIT_TOP_DIR, 'CHANGELOG'), 'r') as f:
     if 'mesos' not in f.readline().lower():

http://git-wip-us.apache.org/repos/asf/mesos/blob/d05c8cad/support/python3/mesos-gtest-runner.py
----------------------------------------------------------------------
diff --git a/support/python3/mesos-gtest-runner.py b/support/python3/mesos-gtest-runner.py
index 153ded2..2edc73d 100755
--- a/support/python3/mesos-gtest-runner.py
+++ b/support/python3/mesos-gtest-runner.py
@@ -89,7 +89,7 @@ def run_test(opts):
             universal_newlines=True)
         print(Bcolors.colorize('.', Bcolors.OKGREEN), end='')
         sys.stdout.flush()
-        return True, output
+        return True, output.decode(sys.stdout.encoding)
     except subprocess.CalledProcessError as error:
         print(Bcolors.colorize('.', Bcolors.FAIL), end='')
         sys.stdout.flush()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d05c8cad/support/python3/push-commits.py
----------------------------------------------------------------------
diff --git a/support/python3/push-commits.py b/support/python3/push-commits.py
index 82a7004..ef63d1a 100755
--- a/support/python3/push-commits.py
+++ b/support/python3/push-commits.py
@@ -41,17 +41,19 @@ from subprocess import check_output
 
 REVIEWBOARD_URL = 'https://reviews.apache.org'
 
+def _check_output(args):
+  return check_output(args).decode(sys.stdout.encoding)
 
 def get_reviews(revision_range):
     """Return the list of reviews found in the commits in the revision range."""
     reviews = [] # List of (review id, commit log) tuples
 
-    rev_list = check_output(['git',
+    rev_list = _check_output(['git',
                              'rev-list',
                              '--reverse',
                              revision_range]).strip().split('\n')
     for rev in rev_list:
-        commit_log = check_output(['git',
+        commit_log = _check_output(['git',
                                    '--no-pager',
                                    'show',
                                    '--no-color',
@@ -79,7 +81,7 @@ def close_reviews(reviews, options):
     for review_id, commit_log in reviews:
         print('Closing review', review_id)
         if not options['dry_run']:
-            check_output(['rbt',
+            _check_output(['rbt',
                           'close',
                           '--description',
                           commit_log,
@@ -107,19 +109,19 @@ def main():
     """Main function to push the commits in this branch as review requests."""
     options = parse_options()
 
-    current_branch_ref = check_output(['git', 'symbolic-ref', 'HEAD']).strip()
+    current_branch_ref = _check_output(['git', 'symbolic-ref', 'HEAD']).strip()
     current_branch = current_branch_ref.replace('refs/heads/', '', 1)
 
     if current_branch != 'master':
         print('Please run this script from master branch')
         sys.exit(1)
 
-    remote_tracking_branch = check_output(['git',
+    remote_tracking_branch = _check_output(['git',
                                            'rev-parse',
                                            '--abbrev-ref',
                                            'master@{upstream}']).strip()
 
-    merge_base = check_output([
+    merge_base = _check_output([
         'git',
         'merge-base',
         remote_tracking_branch,
@@ -132,7 +134,7 @@ def main():
     reviews = get_reviews(merge_base + ".." + current_branch_ref)
 
     # Push the current branch to remote master.
-    remote = check_output(['git',
+    remote = _check_output(['git',
                            'config',
                            '--get',
                            'branch.master.remote']).strip()
@@ -140,13 +142,13 @@ def main():
     print('Pushing commits to', remote)
 
     if options['dry_run']:
-        check_output(['git',
+        _check_output(['git',
                       'push',
                       '--dry-run',
                       remote,
                       'master:master'])
     else:
-        check_output(['git',
+        _check_output(['git',
                       'push',
                       remote,
                       'master:master'])