diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/support | |
parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) | |
download | src-14f1b3e8826ce43b978db93a62d1166055db5394.tar.gz src-14f1b3e8826ce43b978db93a62d1166055db5394.zip |
Vendor import of lldb trunk r290819:vendor/lldb/lldb-trunk-r290819
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=311128
svn path=/vendor/lldb/lldb-trunk-r290819/; revision=311129; tag=vendor/lldb/lldb-trunk-r290819
Diffstat (limited to 'packages/Python/lldbsuite/support')
-rw-r--r-- | packages/Python/lldbsuite/support/encoded_file.py | 23 | ||||
-rw-r--r-- | packages/Python/lldbsuite/support/fs.py | 5 | ||||
-rw-r--r-- | packages/Python/lldbsuite/support/funcutils.py | 10 | ||||
-rw-r--r-- | packages/Python/lldbsuite/support/gmodules.py | 5 | ||||
-rw-r--r-- | packages/Python/lldbsuite/support/optional_with.py | 2 | ||||
-rw-r--r-- | packages/Python/lldbsuite/support/seven.py | 9 | ||||
-rw-r--r-- | packages/Python/lldbsuite/support/sockutil.py | 1 |
7 files changed, 44 insertions, 11 deletions
diff --git a/packages/Python/lldbsuite/support/encoded_file.py b/packages/Python/lldbsuite/support/encoded_file.py index 7581564f7e3a..2c2fef383f7f 100644 --- a/packages/Python/lldbsuite/support/encoded_file.py +++ b/packages/Python/lldbsuite/support/encoded_file.py @@ -14,6 +14,7 @@ import io # Third party modules import six + def _encoded_read(old_read, encoding): def impl(size): result = old_read(size) @@ -24,6 +25,7 @@ def _encoded_read(old_read, encoding): return result return impl + def _encoded_write(old_write, encoding): def impl(s): # If we were asked to write a `str` (in Py2) or a `bytes` (in Py3) decode it @@ -38,9 +40,24 @@ Create a Text I/O file object that can be written to with either unicode strings under Python 2 and Python 3, and automatically encodes and decodes as necessary to return the native string type for the current Python version ''' -def open(file, encoding, mode='r', buffering=-1, errors=None, newline=None, closefd=True): - wrapped_file = io.open(file, mode=mode, buffering=buffering, encoding=encoding, - errors=errors, newline=newline, closefd=closefd) + + +def open( + file, + encoding, + mode='r', + buffering=-1, + errors=None, + newline=None, + closefd=True): + wrapped_file = io.open( + file, + mode=mode, + buffering=buffering, + encoding=encoding, + errors=errors, + newline=newline, + closefd=closefd) new_read = _encoded_read(getattr(wrapped_file, 'read'), encoding) new_write = _encoded_write(getattr(wrapped_file, 'write'), encoding) setattr(wrapped_file, 'read', new_read) diff --git a/packages/Python/lldbsuite/support/fs.py b/packages/Python/lldbsuite/support/fs.py index 9a56808369de..30388596ea16 100644 --- a/packages/Python/lldbsuite/support/fs.py +++ b/packages/Python/lldbsuite/support/fs.py @@ -31,6 +31,7 @@ def _find_file_in_paths(paths, exe_basename): return os.path.normcase(trial_exe_path) return None + def find_executable(executable): """Finds the specified executable in the PATH or known good locations.""" @@ -59,6 +60,6 @@ def find_executable(executable): if not result or len(result) < 1: raise os.OSError( - "failed to find exe='%s' in paths='%s'" % (executable, paths_to_check)) + "failed to find exe='%s' in paths='%s'" % + (executable, paths_to_check)) return result - diff --git a/packages/Python/lldbsuite/support/funcutils.py b/packages/Python/lldbsuite/support/funcutils.py index 53dd1fb370ba..2fa10097d43b 100644 --- a/packages/Python/lldbsuite/support/funcutils.py +++ b/packages/Python/lldbsuite/support/funcutils.py @@ -8,9 +8,17 @@ import inspect # LLDB modules + def requires_self(func): func_argc = len(inspect.getargspec(func).args) - if func_argc == 0 or (getattr(func,'im_self', None) is not None) or (hasattr(func, '__self__')): + if func_argc == 0 or ( + getattr( + func, + 'im_self', + None) is not None) or ( + hasattr( + func, + '__self__')): return False else: return True diff --git a/packages/Python/lldbsuite/support/gmodules.py b/packages/Python/lldbsuite/support/gmodules.py index 4f2fd9643b14..5d66bd14896d 100644 --- a/packages/Python/lldbsuite/support/gmodules.py +++ b/packages/Python/lldbsuite/support/gmodules.py @@ -22,9 +22,8 @@ def is_compiler_clang_with_gmodules(compiler_path): else: # Check the compiler help for the -gmodules option. clang_help = os.popen("%s --help" % compiler_path).read() - return GMODULES_HELP_REGEX.search(clang_help, re.DOTALL) is not None + return GMODULES_HELP_REGEX.search( + clang_help, re.DOTALL) is not None GMODULES_SUPPORT_MAP[compiler_path] = _gmodules_supported_internal() return GMODULES_SUPPORT_MAP[compiler_path] - - diff --git a/packages/Python/lldbsuite/support/optional_with.py b/packages/Python/lldbsuite/support/optional_with.py index 41342288bc6a..f91b3c6fdeb6 100644 --- a/packages/Python/lldbsuite/support/optional_with.py +++ b/packages/Python/lldbsuite/support/optional_with.py @@ -2,6 +2,7 @@ # Provides a with-style resource handler for optionally-None resources # ==================================================================== + class optional_with(object): # pylint: disable=too-few-public-methods # This is a wrapper - it is not meant to provide any extra methods. @@ -39,6 +40,7 @@ class optional_with(object): forget the try/finally using optional_with(), since the with syntax can be used. """ + def __init__(self, wrapped_object): self.wrapped_object = wrapped_object diff --git a/packages/Python/lldbsuite/support/seven.py b/packages/Python/lldbsuite/support/seven.py index 56ddd8db3f66..e04f48308b7d 100644 --- a/packages/Python/lldbsuite/support/seven.py +++ b/packages/Python/lldbsuite/support/seven.py @@ -10,11 +10,16 @@ else: def get_command_status_output(command): try: import subprocess - return (0, subprocess.check_output(command, shell=True, universal_newlines=True)) + return ( + 0, + subprocess.check_output( + command, + shell=True, + universal_newlines=True)) except subprocess.CalledProcessError as e: return (e.returncode, e.output) def get_command_output(command): return get_command_status_output(command)[1] - cmp_ = lambda x, y: (x > y) - (x < y)
\ No newline at end of file + cmp_ = lambda x, y: (x > y) - (x < y) diff --git a/packages/Python/lldbsuite/support/sockutil.py b/packages/Python/lldbsuite/support/sockutil.py index b3d81d14884a..789deed8017a 100644 --- a/packages/Python/lldbsuite/support/sockutil.py +++ b/packages/Python/lldbsuite/support/sockutil.py @@ -14,6 +14,7 @@ import socket # LLDB modules import use_lldb_suite + def recvall(sock, size): bytes = io.BytesIO() while size > 0: |