Commit ad724878 authored by Alexander Schulze's avatar Alexander Schulze Committed by V8 LUCI CQ

[py3] Bump gcmole to py3

Bug: v8:12581
Change-Id: I6c665161a3f376321feb773d809c5453ef1d46f9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3568445Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Alexander Schulze <alexschulze@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79735}
parent d60404e3
...@@ -6,10 +6,8 @@ ...@@ -6,10 +6,8 @@
# This is main driver for gcmole tool. See README for more details. # This is main driver for gcmole tool. See README for more details.
# Usage: CLANG_BIN=clang-bin-dir python tools/gcmole/gcmole.py [arm|arm64|ia32|x64] # Usage: CLANG_BIN=clang-bin-dir python tools/gcmole/gcmole.py [arm|arm64|ia32|x64]
# for py2/py3 compatibility
from __future__ import print_function
from multiprocessing import cpu_count from multiprocessing import cpu_count
from pathlib import Path
import collections import collections
import difflib import difflib
...@@ -20,62 +18,7 @@ import re ...@@ -20,62 +18,7 @@ import re
import subprocess import subprocess
import sys import sys
import threading import threading
import queue
if sys.version_info.major > 2:
from pathlib import Path
import queue
else:
import Queue as queue
default_open = open
def open(path, *args, **kwargs):
return default_open(str(path), *args, **kwargs)
class Path(object):
def __init__(self, path, *args):
if args:
self._path = os.path.join(str(path), *args)
else:
self._path = str(path)
def __div__(self, other):
return Path(self._path, str(other))
def __str__(self):
return self._path
def resolve(self):
return Path(os.path.abspath(self._path))
@property
def parent(self):
return Path(os.path.dirname(self._path))
@property
def parents(self):
current = self
parents = []
while current._path != "" and current._path != "/":
current = current.parent
parents.append(current)
return parents
def is_file(self):
return os.path.isfile(self._path)
def is_dir(self):
return os.path.isdir(self._path)
def exists(self):
return os.path.exists(self._path)
def mkdir(self, parents=False, exist_ok=False):
if parents and not self.parent.exists():
self.parent.mkdir(parents=True, exist_ok=True)
if exist_ok and self.exists():
return
os.mkdir(self._path)
ArchCfg = collections.namedtuple( ArchCfg = collections.namedtuple(
......
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright 2016 the V8 project authors. All rights reserved. # Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# for py2/py3 compatibility
from __future__ import print_function
import os import os
import os.path import os.path
import signal import signal
......
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