diff --git a/tools/release/PRESUBMIT.py b/tools/release/PRESUBMIT.py index ccec6cd7ef..ed4557d98e 100644 --- a/tools/release/PRESUBMIT.py +++ b/tools/release/PRESUBMIT.py @@ -9,7 +9,8 @@ USE_PYTHON3 = True def _CommonChecks(input_api, output_api): tests = input_api.canned_checks.GetUnitTestsInDirectory( - input_api, output_api, '.', files_to_check=['test_scripts.py$']) + input_api, output_api, '.', files_to_check=['test_scripts.py$'], + run_on_python2=False) return input_api.RunTests(tests) def CheckChangeOnUpload(input_api, output_api): diff --git a/tools/release/auto_push.py b/tools/release/auto_push.py index 4cb968787f..eb52e2a316 100755 --- a/tools/release/auto_push.py +++ b/tools/release/auto_push.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -26,9 +26,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# for py2/py3 compatibility -from __future__ import print_function - import argparse import json import os diff --git a/tools/release/auto_roll.py b/tools/release/auto_roll.py index 2aa4ff6829..5d44505c2a 100755 --- a/tools/release/auto_roll.py +++ b/tools/release/auto_roll.py @@ -3,9 +3,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# for py2/py3 compatibility -from __future__ import print_function - import argparse import os import sys diff --git a/tools/release/auto_tag.py b/tools/release/auto_tag.py index 7e77c313d8..1ec9d9431c 100755 --- a/tools/release/auto_tag.py +++ b/tools/release/auto_tag.py @@ -1,11 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# for py2/py3 compatibility -from __future__ import print_function - import argparse import sys diff --git a/tools/release/common_includes.py b/tools/release/common_includes.py index beee818495..afbcc9f837 100644 --- a/tools/release/common_includes.py +++ b/tools/release/common_includes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -26,9 +26,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# for py2/py3 compatibility -from __future__ import print_function - import argparse import datetime from distutils.version import LooseVersion @@ -47,14 +44,8 @@ import urllib from git_recipes import GitRecipesMixin from git_recipes import GitFailedException -PYTHON3 = sys.version_info >= (3, 0) - -if PYTHON3: - import http.client as httplib - import urllib.request as urllib2 -else: - import httplib - import urllib2 +import http.client as httplib +import urllib.request as urllib2 DAY_IN_SECONDS = 24 * 60 * 60 @@ -76,10 +67,6 @@ new_path = path_to_depot_tools + os.pathsep + os.environ.get('PATH') os.environ['PATH'] = new_path -def maybe_decode(obj): - return obj.decode('utf-8') if PYTHON3 else obj - - def TextToFile(text, file_name): with open(file_name, "w") as f: f.write(text) @@ -116,7 +103,7 @@ def Command(cmd, args="", prefix="", pipe=True, cwd=None): sys.stdout.flush() try: if pipe: - return maybe_decode(subprocess.check_output(cmd_line, shell=True, cwd=cwd)) + return subprocess.check_output(cmd_line, shell=True, cwd=cwd).decode('utf-8') else: return subprocess.check_call(cmd_line, shell=True, cwd=cwd) except subprocess.CalledProcessError: diff --git a/tools/release/create_release.py b/tools/release/create_release.py index 62c5ed675f..37e9e8673c 100755 --- a/tools/release/create_release.py +++ b/tools/release/create_release.py @@ -1,11 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# for py2/py3 compatibility -from __future__ import print_function - import argparse import os import sys @@ -13,12 +10,7 @@ import tempfile from common_includes import * -PYTHON3 = sys.version_info >= (3, 0) - -if PYTHON3: - import urllib.request as urllib2 -else: - import urllib2 +import urllib.request as urllib2 class Preparation(Step): diff --git a/tools/release/git_recipes.py b/tools/release/git_recipes.py index a90266aa71..865e13bf31 100644 --- a/tools/release/git_recipes.py +++ b/tools/release/git_recipes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are diff --git a/tools/release/merge_to_branch.py b/tools/release/merge_to_branch.py index 08a36125f8..ca5b2ce674 100755 --- a/tools/release/merge_to_branch.py +++ b/tools/release/merge_to_branch.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -26,9 +26,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# for py2/py3 compatibility -from __future__ import print_function - import argparse from collections import OrderedDict import sys diff --git a/tools/release/roll_merge.py b/tools/release/roll_merge.py index d25f95e397..d1abe56edd 100755 --- a/tools/release/roll_merge.py +++ b/tools/release/roll_merge.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -26,9 +26,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# for py2/py3 compatibility -from __future__ import print_function - import argparse from collections import OrderedDict import sys diff --git a/tools/release/script_test.py b/tools/release/script_test.py index 0f345b7fa8..a0899911c6 100755 --- a/tools/release/script_test.py +++ b/tools/release/script_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2014 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -29,9 +29,6 @@ # Wraps test execution with a coverage analysis. To get the best speed, the # native python coverage version >= 3.7.1 should be installed. -# for py2/py3 compatibility -from __future__ import print_function - import coverage import os import unittest diff --git a/tools/release/test_scripts.py b/tools/release/test_scripts.py index c2c49de8ca..10e2511bc6 100755 --- a/tools/release/test_scripts.py +++ b/tools/release/test_scripts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are @@ -26,9 +26,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# for py2/py3 compatibility -from __future__ import print_function - import json import os import shutil