[Lldb-commits] [lldb] r252330 - [swig] Remove check_lldb_swig_executable_file_exists.
Bruce Mitchener via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 6 10:53:29 PST 2015
Author: brucem
Date: Fri Nov 6 12:53:29 2015
New Revision: 252330
URL: http://llvm.org/viewvc/llvm-project?rev=252330&view=rev
Log:
[swig] Remove check_lldb_swig_executable_file_exists.
Summary:
Code that tried to find swig and then split the path into
a separate path and filename is being removed. The invoking
build system always provides the location of swig and we
don't need to split it into 2 pieces only to recombine it
a short time later.
Reviewers: zturner, domipheus
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D14415
Modified:
lldb/trunk/scripts/Python/buildSwigPython.py
lldb/trunk/scripts/buildSwigWrapperClasses.py
Modified: lldb/trunk/scripts/Python/buildSwigPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/buildSwigPython.py?rev=252330&r1=252329&r2=252330&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/buildSwigPython.py (original)
+++ lldb/trunk/scripts/Python/buildSwigPython.py Fri Nov 6 12:53:29 2015
@@ -44,8 +44,7 @@ strMsgFileNotExist = "\'%s\' could not b
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 @@ def do_swig_rebuild(vDictArgs, vstrSwigD
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 @@ def do_modify_python_lldb(vDictArgs, vst
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 @@ def main(vDictArgs):
bOk = True
strMsg = ""
- if not("--swigExePath" in vDictArgs) and ("--swigExeName" in vDictArgs):
+ if not "--swigExecutable" in vDictArgs:
strErrMsgProgFail += strErrMsgSwigParamsMissing
return (-100, strErrMsgProgFail)
Modified: lldb/trunk/scripts/buildSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/buildSwigWrapperClasses.py?rev=252330&r1=252329&r2=252330&view=diff
==============================================================================
--- lldb/trunk/scripts/buildSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/buildSwigWrapperClasses.py Fri Nov 6 12:53:29 2015
@@ -80,7 +80,7 @@ Args: -h (optional) Print help in
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 @@ def run_swig_for_each_script_supported(v
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 @@ def main(vArgv):
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)
More information about the lldb-commits
mailing list