Updated support scripts to check for Python 3. Review: https://reviews.apache.org/r/67099/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2820028e Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2820028e Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2820028e Branch: refs/heads/master Commit: 2820028e913b934015b77a6dd8ddc1529067a27e Parents: 7ecb2fe Author: Armand Grillet <agril...@mesosphere.io> Authored: Thu May 24 14:58:03 2018 -0700 Committer: Andrew Schwartzmeyer <and...@schwartzmeyer.com> Committed: Thu May 24 14:58:03 2018 -0700 ---------------------------------------------------------------------- support/apply-reviews.py | 5 +++++ support/generate-endpoint-help.py | 5 +++++ support/jsonurl.py | 7 +++++++ support/mesos-gtest-runner.py | 5 +++++ support/mesos-split.py | 8 ++++++++ support/mesos-style.py | 5 +++++ support/post-reviews.py | 6 ++++++ support/push-commits.py | 9 ++++++++- support/test-upgrade.py | 5 +++++ support/verify-reviews.py | 5 +++++ 10 files changed, 59 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/apply-reviews.py ---------------------------------------------------------------------- diff --git a/support/apply-reviews.py b/support/apply-reviews.py index 0c744a9..edddefb 100755 --- a/support/apply-reviews.py +++ b/support/apply-reviews.py @@ -443,6 +443,11 @@ def main(): """ options = parse_options() + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + if options['review_id']: reviewboard(options) else: http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/generate-endpoint-help.py ---------------------------------------------------------------------- diff --git a/support/generate-endpoint-help.py b/support/generate-endpoint-help.py index 7e59b35..54b5408 100755 --- a/support/generate-endpoint-help.py +++ b/support/generate-endpoint-help.py @@ -378,6 +378,11 @@ def main(): # A dictionary of the command line options passed in. options = parse_options() + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + # A pointer to the current subprocess for the master or agent. # This is useful for tracking the master or agent subprocesses so # that we can kill them if the script exits prematurely. http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/jsonurl.py ---------------------------------------------------------------------- diff --git a/support/jsonurl.py b/support/jsonurl.py index 72fe682..c9cf1d9 100755 --- a/support/jsonurl.py +++ b/support/jsonurl.py @@ -25,6 +25,8 @@ play off of 'curl'. """ import json +import os +import subprocess import sys import urllib2 @@ -35,6 +37,11 @@ def main(): print >> sys.stderr, "USAGE: {} URL [KEY...]".format(sys.argv[0]) sys.exit(1) + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + url = sys.argv[1] data = json.loads(urllib2.urlopen(url).read()) http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/mesos-gtest-runner.py ---------------------------------------------------------------------- diff --git a/support/mesos-gtest-runner.py b/support/mesos-gtest-runner.py index 4ae5fe3..9cabbdf 100755 --- a/support/mesos-gtest-runner.py +++ b/support/mesos-gtest-runner.py @@ -198,6 +198,11 @@ def parse_arguments(): if __name__ == '__main__': EXECUTABLE, OPTIONS = parse_arguments() + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + def options_gen(executable, filter_, jobs): """Generator for options for a certain shard. http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/mesos-split.py ---------------------------------------------------------------------- diff --git a/support/mesos-split.py b/support/mesos-split.py index 7ef5c86..f83986d 100755 --- a/support/mesos-split.py +++ b/support/mesos-split.py @@ -21,6 +21,8 @@ the projects which make up mesos. """ from collections import defaultdict +import os +import subprocess import sys if len(sys.argv) < 2: @@ -60,6 +62,12 @@ def main(): See `support/hooks/pre-commit` for the canonical usage of this method. """ + + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + touched_projects = defaultdict(list) for filename in sys.argv[1:]: touched_projects[find_project(filename)].append(filename) http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/mesos-style.py ---------------------------------------------------------------------- diff --git a/support/mesos-style.py b/support/mesos-style.py index b7ee699..805ecb7 100755 --- a/support/mesos-style.py +++ b/support/mesos-style.py @@ -509,6 +509,11 @@ if __name__ == '__main__': if should_build_virtualenv(sys.argv[1:]): build_virtualenv() + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + # TODO(ArmandGrillet): We should only instantiate the linters # required to lint the files to analyze. See MESOS-8351. CPP_LINTER = CppLinter() http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/post-reviews.py ---------------------------------------------------------------------- diff --git a/support/post-reviews.py b/support/post-reviews.py index a6646f2..94ece85 100755 --- a/support/post-reviews.py +++ b/support/post-reviews.py @@ -44,6 +44,7 @@ import imp import os import platform import re +import subprocess import sys import urlparse @@ -90,6 +91,11 @@ def main(): """Main function, post commits added to this branch as review requests.""" # TODO(benh): Make sure this is a git repository, apologize if not. + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + # Choose 'rbt' if available, otherwise choose 'post-review'. post_review = None http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/push-commits.py ---------------------------------------------------------------------- diff --git a/support/push-commits.py b/support/push-commits.py index cd751cb..b10e802 100755 --- a/support/push-commits.py +++ b/support/push-commits.py @@ -35,9 +35,11 @@ Example Usage: import argparse import os import re +import subprocess +from subprocess import check_output + import sys -from subprocess import check_output REVIEWBOARD_URL = 'https://reviews.apache.org' @@ -106,6 +108,11 @@ def main(): """Main function to push the commits in this branch as review requests.""" options = parse_options() + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + current_branch_ref = check_output(['git', 'symbolic-ref', 'HEAD']).strip() current_branch = current_branch_ref.replace('refs/heads/', '', 1) http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/test-upgrade.py ---------------------------------------------------------------------- diff --git a/support/test-upgrade.py b/support/test-upgrade.py index 53c0688..b7c6612 100755 --- a/support/test-upgrade.py +++ b/support/test-upgrade.py @@ -187,6 +187,11 @@ def main(): required=True) args = parser.parse_args() + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + # Get the version strings from the built executables. prev_version = version(args.prev) next_version = version(args.next) http://git-wip-us.apache.org/repos/asf/mesos/blob/2820028e/support/verify-reviews.py ---------------------------------------------------------------------- diff --git a/support/verify-reviews.py b/support/verify-reviews.py index fbc2460..c86db35 100755 --- a/support/verify-reviews.py +++ b/support/verify-reviews.py @@ -298,6 +298,11 @@ def needs_verification(review_request): def main(): """Main function to verify the submitted reviews.""" + # TODO(ArmandGrillet): Remove this when we'll have switched to Python 3. + dir_path = os.path.dirname(os.path.realpath(__file__)) + script_path = os.path.join(dir_path, 'check-python3.py') + subprocess.call('python ' + script_path, shell=True, cwd=dir_path) + review_requests_url = \ "%s/api/review-requests/%s" % (REVIEWBOARD_URL, QUERY_PARAMS)