From b9c1b51e45b845debb76d8658edabca70ca56079 Mon Sep 17 00:00:00 2001 From: Kate Stone Date: Tue, 6 Sep 2016 20:57:50 +0000 Subject: =?UTF-8?q?***=20This=20commit=20represents=20a=20complete=20refor?= =?UTF-8?q?matting=20of=20the=20LLDB=20source=20code=20***=20to=20conform?= =?UTF-8?q?=20to=20clang-format=E2=80=99s=20LLVM=20style.=20=20This=20kind?= =?UTF-8?q?=20of=20mass=20change=20has=20***=20two=20obvious=20implication?= =?UTF-8?q?s:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- lldb/scripts/finishSwigWrapperClasses.py | 84 ++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 26 deletions(-) (limited to 'lldb/scripts/finishSwigWrapperClasses.py') diff --git a/lldb/scripts/finishSwigWrapperClasses.py b/lldb/scripts/finishSwigWrapperClasses.py index cce160d..4607624 100644 --- a/lldb/scripts/finishSwigWrapperClasses.py +++ b/lldb/scripts/finishSwigWrapperClasses.py @@ -34,10 +34,12 @@ import utilsOsType # Determine the OS type this script is running on import utilsDebug # Debug Python scripts # Instantiations: -gbDbgVerbose = False # True = Turn on script function tracing, False = off. +# True = Turn on script function tracing, False = off. +gbDbgVerbose = False gbDbgFlag = False # Global debug mode flag, set by input parameter - # --dbgFlag. True = operate in debug mode. -gbMakeFileFlag = False # True = yes called from makefile system, False = not. +# --dbgFlag. True = operate in debug mode. +# True = yes called from makefile system, False = not. +gbMakeFileFlag = False # User facing text: strMsgErrorNoMain = "Program called by another Python script not allowed" @@ -84,7 +86,7 @@ Usage:\n\ finishSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath\n\ --cfgBldDir=ADirPath --prefix=ADirPath --lldbLibDir=ADirPath -m -d\n\ \n\ -" #TAG_PROGRAM_HELP_INFO +" # TAG_PROGRAM_HELP_INFO #++--------------------------------------------------------------------------- # Details: Exit the program on success. Called on program successfully done @@ -94,6 +96,8 @@ Usage:\n\ # Returns: None. # Throws: None. #-- + + def program_exit_success(vnResult, vMsg): strMsg = "" @@ -111,6 +115,8 @@ def program_exit_success(vnResult, vMsg): # Returns: None. # Throws: None. #-- + + def program_exit_on_failure(vnResult, vMsg): print(("%s%s (%d)" % (strExitMsgError, vMsg, vnResult))) sys.exit(vnResult) @@ -124,6 +130,8 @@ def program_exit_on_failure(vnResult, vMsg): # Returns: None. # Throws: None. #-- + + def program_exit(vnResult, vMsg): if vnResult >= 0: program_exit_success(vnResult, vMsg) @@ -136,6 +144,8 @@ def program_exit(vnResult, vMsg): # Returns: None. # Throws: None. #-- + + def print_out_input_parameters(vDictArgs): for arg, val in list(vDictArgs.items()): strEqs = "" @@ -153,24 +163,32 @@ def print_out_input_parameters(vDictArgs): # Dict - Map of arguments names to argument values # Throws: None. #-- + + def validate_arguments(vArgv): dbg = utilsDebug.CDebugFnVerbose("validate_arguments()") strMsg = "" dictArgs = {} nResult = 0 - strListArgs = "hdm" # Format "hiox:" = -h -i -o -x - listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=", "cmakeBuildConfiguration=", - "lldbLibDir=", "argsFile"] - dictArgReq = { "-h": "o", # o = optional, m = mandatory - "-d": "o", - "-m": "o", - "--srcRoot": "m", - "--targetDir": "m", - "--cfgBldDir": "o", - "--prefix": "o", - "--cmakeBuildConfiguration": "o", - "--lldbLibDir": "o", - "--argsFile": "o" } + strListArgs = "hdm" # Format "hiox:" = -h -i -o -x + listLongArgs = [ + "srcRoot=", + "targetDir=", + "cfgBldDir=", + "prefix=", + "cmakeBuildConfiguration=", + "lldbLibDir=", + "argsFile"] + dictArgReq = {"-h": "o", # o = optional, m = mandatory + "-d": "o", + "-m": "o", + "--srcRoot": "m", + "--targetDir": "m", + "--cfgBldDir": "o", + "--prefix": "o", + "--cmakeBuildConfiguration": "o", + "--lldbLibDir": "o", + "--argsFile": "o"} # Check for mandatory parameters nResult, dictArgs, strMsg = utilsArgsParse.parse(vArgv, strListArgs, @@ -196,18 +214,24 @@ def validate_arguments(vArgv): # Str - Error message. # Throws: None. #-- + + def run_post_process(vStrScriptLang, vstrFinishFileName, vDictArgs): dbg = utilsDebug.CDebugFnVerbose("run_post_process()") nResult = 0 strStatusMsg = "" strScriptFile = vstrFinishFileName % vStrScriptLang - strScriptFileDir = os.path.normpath(os.path.join(vDictArgs["--srcRoot"], "scripts", vStrScriptLang)) + strScriptFileDir = os.path.normpath( + os.path.join( + vDictArgs["--srcRoot"], + "scripts", + vStrScriptLang)) strScriptFilePath = os.path.join(strScriptFileDir, strScriptFile) # Check for the existence of the script file strPath = os.path.normcase(strScriptFilePath) bOk = os.path.exists(strPath) - if bOk == False: + if not bOk: strDir = os.path.normcase(strScriptFileDir) strStatusMsg = strScriptNotFound % (strScriptFile, strDir) return (-9, strStatusMsg) @@ -221,7 +245,7 @@ def run_post_process(vStrScriptLang, vstrFinishFileName, vDictArgs): sys.path.append(strDir) # Execute the specific language script - dictArgs = vDictArgs # Remove any args not required before passing on + dictArgs = vDictArgs # Remove any args not required before passing on strModuleName = strScriptFile[: strScriptFile.__len__() - 3] module = __import__(strModuleName) nResult, strStatusMsg = module.main(dictArgs) @@ -242,17 +266,23 @@ def run_post_process(vStrScriptLang, vstrFinishFileName, vDictArgs): # Str - Error message. # Throws: None. #-- + + def run_post_process_for_each_script_supported(vDictArgs): - dbg = utilsDebug.CDebugFnVerbose("run_post_process_for_each_script_supported()") + dbg = utilsDebug.CDebugFnVerbose( + "run_post_process_for_each_script_supported()") nResult = 0 strStatusMsg = "" - strScriptDir = os.path.normpath(os.path.join(vDictArgs["--srcRoot"], "scripts")) + strScriptDir = os.path.normpath( + os.path.join( + vDictArgs["--srcRoot"], + "scripts")) strFinishFileName = "finishSwig%sLLDB.py" # Check for the existence of the scripts folder strScriptsDir = os.path.normcase(strScriptDir) bOk = os.path.exists(strScriptsDir) - if bOk == False: + if not bOk: return (-8, strScriptDirNotFound) # Look for any script language directories to build for @@ -263,8 +293,8 @@ def run_post_process_for_each_script_supported(vDictArgs): # __pycache__ is a magic directory in Python 3 that holds .pyc files if scriptLang != "__pycache__" and scriptLang != "swig_bot_lib": dbg.dump_text("Executing language script for \'%s\'" % scriptLang) - nResult, strStatusMsg = run_post_process(scriptLang, strFinishFileName, - vDictArgs) + nResult, strStatusMsg = run_post_process( + scriptLang, strFinishFileName, vDictArgs) if nResult < 0: break @@ -283,6 +313,8 @@ def run_post_process_for_each_script_supported(vDictArgs): # Returns: None # Throws: None. #-- + + def main(vArgv): dbg = utilsDebug.CDebugFnVerbose("main()") bOk = False @@ -317,7 +349,7 @@ def main(vArgv): #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- -#TAG_PROGRAM_HELP_INFO +# TAG_PROGRAM_HELP_INFO """ Details: Program main entry point. -------------------------------------------------------------------------- -- cgit v1.1