diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/third_party/Python/module/pexpect-2.4/examples/script.py | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/third_party/Python/module/pexpect-2.4/examples/script.py')
-rw-r--r-- | lldb/third_party/Python/module/pexpect-2.4/examples/script.py | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/lldb/third_party/Python/module/pexpect-2.4/examples/script.py b/lldb/third_party/Python/module/pexpect-2.4/examples/script.py index 908b91241a6..41e2ea81428 100644 --- a/lldb/third_party/Python/module/pexpect-2.4/examples/script.py +++ b/lldb/third_party/Python/module/pexpect-2.4/examples/script.py @@ -18,33 +18,45 @@ Example: """ -import os, sys, time, getopt -import signal, fcntl, termios, struct +import os +import sys +import time +import getopt +import signal +import fcntl +import termios +import struct import traceback import pexpect -global_pexpect_instance = None # Used by signal handler +global_pexpect_instance = None # Used by signal handler + def exit_with_usage(): print globals()['__doc__'] os._exit(1) + def main(): ###################################################################### # Parse the options, arguments, get ready, etc. ###################################################################### try: - optlist, args = getopt.getopt(sys.argv[1:], 'h?ac:', ['help','h','?']) - except Exception, e: + optlist, args = getopt.getopt( + sys.argv[ + 1:], 'h?ac:', [ + 'help', 'h', '?']) + except Exception as e: print str(e) exit_with_usage() options = dict(optlist) if len(args) > 1: exit_with_usage() - - if [elem for elem in options if elem in ['-h','--h','-?','--?','--help']]: + + if [elem for elem in options if elem in [ + '-h', '--h', '-?', '--?', '--help']]: print "Help:" exit_with_usage() @@ -53,17 +65,17 @@ def main(): else: script_filename = "script.log" if '-a' in options: - fout = file (script_filename, "ab") + fout = file(script_filename, "ab") else: - fout = file (script_filename, "wb") + fout = file(script_filename, "wb") if '-c' in options: command = options['-c'] else: command = "sh" # Begin log with date/time in the form CCCCyymm.hhmmss - fout.write ('# %4d%02d%02d.%02d%02d%02d \n' % time.localtime()[:-3]) - + fout.write('# %4d%02d%02d.%02d%02d%02d \n' % time.localtime()[:-3]) + ###################################################################### # Start the interactive session ###################################################################### @@ -78,26 +90,26 @@ def main(): fout.close() return 0 -def sigwinch_passthrough (sig, data): + +def sigwinch_passthrough(sig, data): # Check for buggy platforms (see pexpect.setwinsize()). if 'TIOCGWINSZ' in dir(termios): TIOCGWINSZ = termios.TIOCGWINSZ else: - TIOCGWINSZ = 1074295912 # assume - s = struct.pack ("HHHH", 0, 0, 0, 0) - a = struct.unpack ('HHHH', fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ , s)) + TIOCGWINSZ = 1074295912 # assume + s = struct.pack("HHHH", 0, 0, 0, 0) + a = struct.unpack('HHHH', fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ, s)) global global_pexpect_instance - global_pexpect_instance.setwinsize(a[0],a[1]) + global_pexpect_instance.setwinsize(a[0], a[1]) if __name__ == "__main__": try: main() - except SystemExit, e: + except SystemExit as e: raise e - except Exception, e: + except Exception as e: print "ERROR" print str(e) traceback.print_exc() os._exit(1) - |