Commit 6d1825e2 authored by Michael Achenbach's avatar Michael Achenbach Committed by V8 LUCI CQ

[release] Clean up python2 code

No-Try: true
Bug: chromium:1292013
Change-Id: Id9966157d28528b28e820d328b4941287a310209
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3521790Reviewed-by: 's avatarLiviu Rau <liviurau@chromium.org>
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79476}
parent a875615c
......@@ -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):
......
#!/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
......
......@@ -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
......
#!/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
......
#!/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:
......
#!/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):
......
#!/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
......
#!/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
......
#!/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
......
#!/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
......
#!/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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment