Index: lldb/trunk/scripts/Python/buildSwigPython.py =================================================================== --- lldb/trunk/scripts/Python/buildSwigPython.py +++ lldb/trunk/scripts/Python/buildSwigPython.py @@ -44,8 +44,7 @@ strErrMsgOsTypeUnknown = "Unable to determine current OS type" strMsgNotNeedUpdate = "Everything is up-to-date" strMsgSwigNeedRebuild = "SWIG needs to be re-run" -strErrMsgSwigParamsMissing = "This script was not passed either '--swigExePath \ -or the '--swigExeName' argument. Both are required." +strErrMsgSwigParamsMissing = "This script was not passed '--swigExecutable' as required." strMsgSwigExecute = "SWIG executing the following:\n\'%s'" strErrMsgSwigExecute = "SWIG failed: %s" strErrMsgPythonExecute = "Python script '%s' failed: %s" @@ -463,17 +462,9 @@ strMsg = "" bDbg = "-d" in vDictArgs bGenDependencies = "-M" in vDictArgs - strSwigExePath = vDictArgs["--swigExePath"] - strSwigExeName = vDictArgs["--swigExeName"] + strSwig = vDictArgs["--swigExecutable"] strSrcRoot = vDictArgs["--srcRoot"] - # Build SWIG path to executable - if strSwigExePath != "": - strSwig = "%s/%s" % (strSwigExePath, strSwigExeName) - strSwig = os.path.normcase(strSwig) - else: - strSwig = strSwigExeName - strCfg = vstrCfgBldDir strOp = vstrSwigOpFile strIp = vstrSwigIpFile @@ -615,27 +606,24 @@ Args: vDictArgs - (R) Map of parameter names to values. Used to for the the SWIG required parameters to create code. Note this container does get amended with more data. - -d (optional) Determines whether or not this script - outputs additional information when running. - -m (optional) Specify called from Makefile system. If given locate - the LLDBWrapPython.cpp in --srcRoot/source folder - else in the --targetDir folder. - -M (optional) Specify want SWIG to generate a dependency file. - --srcRoot The root of the lldb source tree. - --targetDir Where the lldb framework/shared library gets put. - --cfgBldDir Where the buildSwigPythonLLDB.py program will - (optional) put the lldb.py file it generated from running - SWIG. - --prefix Is the root directory used to determine where - (optional) third-party modules for scripting languages should - be installed. Where non-Darwin systems want to put - the .py and .so files so that Python can find them - automatically. Python install directory. - --swigExePath File path the SWIG executable. (Determined and - passed by buildSwigWrapperClasses.py to here) - --swigExeName The file name of the SWIG executable. (Determined - and passed by buildSwigWrapperClasses.py to - here) + -d (optional) Determines whether or not this script + outputs additional information when running. + -m (optional) Specify called from Makefile system. If given locate + the LLDBWrapPython.cpp in --srcRoot/source folder + else in the --targetDir folder. + -M (optional) Specify want SWIG to generate a dependency file. + --srcRoot The root of the lldb source tree. + --targetDir Where the lldb framework/shared library gets put. + --cfgBldDir Where the buildSwigPythonLLDB.py program will + (optional) put the lldb.py file it generated from running + SWIG. + --prefix Is the root directory used to determine where + (optional) third-party modules for scripting languages should + be installed. Where non-Darwin systems want to put + the .py and .so files so that Python can find them + automatically. Python install directory. + --swigExecutable Full path to the SWIG executable. (Determined and + passed by buildSwigWrapperClasses.py to here) Results: 0 Success 1 Success, generated dependencies removed LLDBWrapPython.cpp.d. @@ -651,7 +639,7 @@ bOk = True strMsg = "" - if not("--swigExePath" in vDictArgs) and ("--swigExeName" in vDictArgs): + if not "--swigExecutable" in vDictArgs: strErrMsgProgFail += strErrMsgSwigParamsMissing return (-100, strErrMsgProgFail) Index: lldb/trunk/scripts/buildSwigWrapperClasses.py =================================================================== --- lldb/trunk/scripts/buildSwigWrapperClasses.py +++ lldb/trunk/scripts/buildSwigWrapperClasses.py @@ -80,7 +80,7 @@ automatically. Python install directory.\n\ --argsFile= The args are read from a file instead of the\n\ command line. Other command line args are ignored.\n\ - --swigExecutable= (optional) Full path of swig executable.\n\ + --swigExecutable= Full path of swig executable.\n\ \n\ Usage:\n\ buildSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath\n\ @@ -310,137 +310,6 @@ return (nResult, strStatusMsg) #++--------------------------------------------------------------------------- -# Details: Dummy function - system unknown. Function should not be called. -# Args: vDictArgs - (R) Program input parameters. -# Returns: Bool - False = Program logic error. -# Str - Error message. -# Throws: None. -#-- -def check_lldb_swig_executable_file_exists_Unknown(vDictArgs): - dbg = utilsDebug.CDebugFnVerbose("check_lldb_swig_executable_file_exists_Unknown()") - # Do nothing - return (False, strMsgErrorOsTypeUnknown) - -#++--------------------------------------------------------------------------- -# Details: Locate the SWIG executable file in a Windows system. Several hard -# coded predetermined possible file path locations are searched. -# (This is good candidate for a derived class object) -# Args: vDictArgs - (W) Program input parameters. -# Returns: Bool - True = Success. -# - False = Failure file not found. -# Str - Error message. -# Throws: None. -#-- -def check_lldb_swig_executable_file_exists_Windows(vDictArgs): - dbg = utilsDebug.CDebugFnVerbose("check_lldb_swig_executable_file_exists_Windows()") - - # Will always be true as it assumed the path to SWIG executable will be - # in the OS system environmental variable %PATH%. Easier this way as the - # user may have renamed the directory and or custom path installation. - bExeFileFound = True - vDictArgs["--swigExePath"] = "" - vDictArgs["--swigExeName"] = "swig.exe" - return (bExeFileFound, None) - -#++--------------------------------------------------------------------------- -# Details: Locate the SWIG executable file in a Linux system. Several hard -# coded predetermined possible file path locations are searched. -# (This is good candidate for a derived class object) -# Args: vDictArgs - (W) Program input parameters. -# Returns: Bool - True = Success. -# - False = Failure file not found. -# Str - Error message. -# Throws: None. -#-- -def check_lldb_swig_executable_file_exists_Linux(vDictArgs): - dbg = utilsDebug.CDebugFnVerbose("check_lldb_swig_executable_file_exists_Linux()") - bExeFileFound = False - - strSwigExe = "swig" - strSwigExePath = "/usr/bin" - strExe = os.path.normcase("%s/%s" % (strSwigExePath, strSwigExe)) - if os.path.isfile(strExe) and os.access(strExe, os.X_OK): - bExeFileFound = True - vDictArgs["--swigExePath"] = os.path.normcase(strSwigExePath) - vDictArgs["--swigExeName"] = strSwigExe - return (bExeFileFound, None) - - strSwigExePath = "/usr/local/bin" - strExe = os.path.normcase("%s/%s" % (strSwigExePath, strSwigExe)) - if os.path.isfile(strExe) and os.access(strExe, os.X_OK): - bExeFileFound = True - vDictArgs["--swigExePath"] = os.path.normcase(strSwigExePath) - vDictArgs["--swigExeName"] = strSwigExe - return (bExeFileFound, None) - - return (bExeFileFound, strSwigExeFileNotFound) - -#++--------------------------------------------------------------------------- -# Details: Locate the SWIG executable file in a OSX system. Several hard -# coded predetermined possible file path locations are searched. -# (This is good candidate for a derived class object) -# Args: vDictArgs - (W) Program input parameters. -# Returns: Bool - True = Success. -# - False = Failure file not found. -# Str - Error message. -# Throws: None. -#-- -def check_lldb_swig_executable_file_exists_Darwin(vDictArgs): - dbg = utilsDebug.CDebugFnVerbose("check_lldb_swig_executable_file_exists_Darwin()") - bExeFileFound = False - # ToDo: Find the SWIG executable and add the path to the args dictionary - #vDictArgs.["--swigExePath"] = "/usr/bin/swig" - strStatusMsg = "Sorry function 'check_lldb_swig_executable_file_exists_Darwin()' is not implemented" - - return (bExeFileFound, strStatusMsg) - -#++--------------------------------------------------------------------------- -# Details: Locate the SWIG executable file in a OSX system. Several hard -# coded predetermined possible file path locations are searched. -# (This is good candidate for a derived class object) -# Args: vDictArgs - (W) Program input parameters. -# Returns: Bool - True = Success. -# - False = Failure file not found. -# Str - Error message. -# Throws: None. -#-- -def check_lldb_swig_executable_file_exists_FreeBSD(vDictArgs): - dbg = utilsDebug.CDebugFnVerbose("check_lldb_swig_executable_file_exists_FreeBSD()") - bExeFileFound = False - # ToDo: Find the SWIG executable and add the path to the args dictionary - #vDictArgs.["--swigExePath"] = "/usr/bin/swig" - strStatusMsg = "Sorry function 'check_lldb_swig_executable_file_exists_FreeBSD()' is not implemented" - - return (bExeFileFound, strStatusMsg) - -#++--------------------------------------------------------------------------- -# Details: Locate the SWIG executable file. Several hard coded predetermined -# possible file path locations are searched. -# Args: vDictArgs - (RW) Program input parameters. -# veOSType - (R) Current OS type enumeration. -# Returns: Bool - True = Success. -# - False = Failure file not found. -# Str - Error message. -# Throws: None. -#-- -def check_lldb_swig_executable_file_exists(vDictArgs, veOSType): - dbg = utilsDebug.CDebugFnVerbose("check_lldb_swig_executable_file_exists()") - bExeFileFound = False - strStatusMsg = "" - if "--swigExecutable" in vDictArgs: - vDictArgs["--swigExeName"] = os.path.basename(vDictArgs["--swigExecutable"]) - vDictArgs["--swigExePath"] = os.path.dirname(vDictArgs["--swigExecutable"]) - bExeFileFound = True - else: - from utilsOsType import EnumOsType - switch = {EnumOsType.Unknown : check_lldb_swig_executable_file_exists_Unknown, - EnumOsType.Darwin : check_lldb_swig_executable_file_exists_Darwin, - EnumOsType.FreeBSD : check_lldb_swig_executable_file_exists_FreeBSD, - EnumOsType.Linux : check_lldb_swig_executable_file_exists_Linux, - EnumOsType.Windows : check_lldb_swig_executable_file_exists_Windows} - bExeFileFound, strStatusMsg = switch[veOSType](vDictArgs) - return (bExeFileFound, strStatusMsg) -#++--------------------------------------------------------------------------- # Details: Validate the arguments passed to the program. This function exits # the program should error with the arguments be found. # Args: vArgv - (R) List of arguments and values. @@ -522,10 +391,6 @@ if bOk == False: program_exit(-3, strMsg) - bOk, strMsg = check_lldb_swig_executable_file_exists(dictArgs, eOSType) - if bOk == False: - program_exit(-6, strMsg) - nResult, strMsg = run_swig_for_each_script_supported(dictArgs) program_exit(nResult, strMsg)