2015-10-17 01:52:12 +08:00
|
|
|
|
""" Post process SWIG Bridge wrapper code Python script for Windows/LINUX/OSX platform
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
2015-03-21 03:53:49 +08:00
|
|
|
|
--------------------------------------------------------------------------
|
|
|
|
|
File: finishSwigWrapperClasses.py
|
|
|
|
|
|
|
|
|
|
Overview: Python script(s) to finish off the SWIG Python C++ Script
|
|
|
|
|
Bridge wrapper code on the Windows/LINUX/OSX platform.
|
|
|
|
|
The Python scripts are equivalent to the shell script (.sh)
|
|
|
|
|
files.
|
|
|
|
|
We use SWIG to create a C++ file containing the appropriate
|
|
|
|
|
wrapper classes and functions for each scripting language,
|
|
|
|
|
before liblldb is built (thus the C++ file can be compiled
|
|
|
|
|
into liblldb. In some cases, additional work may need to be
|
|
|
|
|
done after liblldb has been compiled, to make the scripting
|
|
|
|
|
language stuff fully functional. Any such post-processing
|
|
|
|
|
is handled through the Python scripts called here.
|
|
|
|
|
|
|
|
|
|
Gotchas: None.
|
|
|
|
|
|
|
|
|
|
Copyright: None.
|
|
|
|
|
--------------------------------------------------------------------------
|
|
|
|
|
|
2014-07-02 01:57:19 +08:00
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Python modules:
|
2015-03-21 03:53:49 +08:00
|
|
|
|
import sys # Provide argument parsing
|
|
|
|
|
import os # Provide directory and file handling
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
# Third party modules:
|
|
|
|
|
|
|
|
|
|
# In-house modules:
|
2015-03-21 03:53:49 +08:00
|
|
|
|
import utilsArgsParse # Parse and validate this script's input arguments
|
|
|
|
|
import utilsOsType # Determine the OS type this script is running on
|
|
|
|
|
import utilsDebug # Debug Python scripts
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
# Instantiations:
|
2016-09-07 04:57:50 +08:00
|
|
|
|
# True = Turn on script function tracing, False = off.
|
|
|
|
|
gbDbgVerbose = False
|
2015-11-06 07:57:33 +08:00
|
|
|
|
gbDbgFlag = False # Global debug mode flag, set by input parameter
|
2016-09-07 04:57:50 +08:00
|
|
|
|
# --dbgFlag. True = operate in debug mode.
|
|
|
|
|
# True = yes called from makefile system, False = not.
|
|
|
|
|
gbMakeFileFlag = False
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
# User facing text:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strMsgErrorNoMain = "Program called by another Python script not allowed"
|
|
|
|
|
strExitMsgSuccess = "Program successful"
|
|
|
|
|
strExitMsgError = "Program error: "
|
|
|
|
|
strParameter = "Parameter: "
|
2014-07-02 01:57:19 +08:00
|
|
|
|
strMsgErrorOsTypeUnknown = "Unable to determine OS type"
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strScriptDirNotFound = "Unable to locate the script directory \'/script\'"
|
|
|
|
|
strScriptLangsFound = "Found the following script languages:"
|
|
|
|
|
strPostProcessError = "Executing \'%s\' post process script failed: "
|
|
|
|
|
strScriptNotFound = "Unable to locate the post process script file \'%s\' in \'%s\'"
|
|
|
|
|
strScriptLangFound = "Found \'%s\' build script."
|
|
|
|
|
strScriptLangsFound = "Found the following script languages:"
|
|
|
|
|
strExecuteMsg = "Executing \'%s\' build script..."
|
|
|
|
|
strExecuteError = "Executing \'%s\' build script failed: "
|
2014-07-02 01:57:19 +08:00
|
|
|
|
strHelpInfo = "\
|
|
|
|
|
Python script(s) to finish off the SWIG Python C++ Script \n\
|
|
|
|
|
Bridge wrapper code on the Windows/LINUX/OSX platform. The Python \n\
|
|
|
|
|
scripts are equivalent to the shell script (.sh) files \n\
|
|
|
|
|
run on others platforms.\n\
|
2015-03-21 03:53:49 +08:00
|
|
|
|
Args: -h (optional) Print help information on this program.\n\
|
|
|
|
|
-d (optional) Determines whether or not this script\n\
|
|
|
|
|
outputs additional information when running.\n\
|
|
|
|
|
-m (optional) Specify called from Makefile system.\n\
|
|
|
|
|
--srcRoot= The root of the lldb source tree.\n\
|
|
|
|
|
--targetDir= Where the lldb framework/shared library gets put.\n\
|
|
|
|
|
--cfgBldDir= (optional) Where the build-swig-Python-LLDB.py program \n\
|
|
|
|
|
will put the lldb.py file it generated from running\n\
|
|
|
|
|
SWIG.\n\
|
|
|
|
|
--prefix= (optional) Is the root directory used to determine where\n\
|
|
|
|
|
third-party modules for scripting languages should\n\
|
|
|
|
|
be installed. Where non-Darwin systems want to put\n\
|
|
|
|
|
the .py and .so files so that Python can find them\n\
|
|
|
|
|
automatically. Python install directory.\n\
|
2016-04-26 04:34:34 +08:00
|
|
|
|
--lldbLibDir (optional) The name of the directory containing liblldb.so.\n\
|
|
|
|
|
\"lib\" by default.\n\
|
2015-03-21 03:53:49 +08:00
|
|
|
|
--cmakeBuildConfiguration= (optional) Is the build configuration(Debug, Release, RelWithDebugInfo)\n\
|
|
|
|
|
used to determine where the bin and lib directories are \n\
|
|
|
|
|
created for a Windows build.\n\
|
|
|
|
|
--argsFile= The args are read from a file instead of the\n\
|
|
|
|
|
command line. Other command line args are ignored.\n\
|
2017-02-04 08:20:24 +08:00
|
|
|
|
--useSystemSix Use system six.py version.\n\
|
2014-07-02 01:57:19 +08:00
|
|
|
|
\n\
|
|
|
|
|
Usage:\n\
|
2015-03-21 03:53:49 +08:00
|
|
|
|
finishSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath\n\
|
2016-04-26 04:34:34 +08:00
|
|
|
|
--cfgBldDir=ADirPath --prefix=ADirPath --lldbLibDir=ADirPath -m -d\n\
|
2014-07-02 01:57:19 +08:00
|
|
|
|
\n\
|
2016-09-07 04:57:50 +08:00
|
|
|
|
" # TAG_PROGRAM_HELP_INFO
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Exit the program on success. Called on program successfully done
|
|
|
|
|
# its work. Returns a status result to the caller.
|
|
|
|
|
# Args: vnResult - (R) 0 or greater indicating success.
|
|
|
|
|
# vMsg - (R) Success message if any to show success to user.
|
|
|
|
|
# Returns: None.
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def program_exit_success(vnResult, vMsg):
|
|
|
|
|
strMsg = ""
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-03-21 03:59:35 +08:00
|
|
|
|
if vMsg.__len__() != 0:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strMsg = "%s: %s (%d)" % (strExitMsgSuccess, vMsg, vnResult)
|
|
|
|
|
print(strMsg)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
sys.exit(vnResult)
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Exit the program with error. Called on exit program failed its
|
|
|
|
|
# task. Returns a status result to the caller.
|
|
|
|
|
# Args: vnResult - (R) A negative number indicating error condition.
|
|
|
|
|
# vMsg - (R) Error message to show to user.
|
|
|
|
|
# Returns: None.
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def program_exit_on_failure(vnResult, vMsg):
|
|
|
|
|
print(("%s%s (%d)" % (strExitMsgError, vMsg, vnResult)))
|
|
|
|
|
sys.exit(vnResult)
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Exit the program return a exit result number and print a message.
|
|
|
|
|
# Positive numbers and zero are returned for success other error
|
|
|
|
|
# occurred.
|
|
|
|
|
# Args: vnResult - (R) A -ve (an error), 0 or +ve number (ok or status).
|
|
|
|
|
# vMsg - (R) Error message to show to user.
|
|
|
|
|
# Returns: None.
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def program_exit(vnResult, vMsg):
|
2015-03-21 03:53:49 +08:00
|
|
|
|
if vnResult >= 0:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit_success(vnResult, vMsg)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
else:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit_on_failure(vnResult, vMsg)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Dump input parameters.
|
|
|
|
|
# Args: vDictArgs - (R) Map of input args to value.
|
|
|
|
|
# Returns: None.
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def print_out_input_parameters(vDictArgs):
|
2015-10-20 07:45:25 +08:00
|
|
|
|
for arg, val in list(vDictArgs.items()):
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strEqs = ""
|
|
|
|
|
strQ = ""
|
2015-03-21 03:53:49 +08:00
|
|
|
|
if val.__len__() != 0:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strEqs = " ="
|
|
|
|
|
strQ = "\""
|
|
|
|
|
print(("%s%s%s %s%s%s\n" % (strParameter, arg, strEqs, strQ, val, strQ)))
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# 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.
|
|
|
|
|
# Returns: Int - 0 = success, -ve = some failure.
|
|
|
|
|
# Dict - Map of arguments names to argument values
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def validate_arguments(vArgv):
|
|
|
|
|
dbg = utilsDebug.CDebugFnVerbose("validate_arguments()")
|
|
|
|
|
strMsg = ""
|
|
|
|
|
dictArgs = {}
|
|
|
|
|
nResult = 0
|
2016-09-07 04:57:50 +08:00
|
|
|
|
strListArgs = "hdm" # Format "hiox:" = -h -i -o -x <arg>
|
|
|
|
|
listLongArgs = [
|
|
|
|
|
"srcRoot=",
|
|
|
|
|
"targetDir=",
|
|
|
|
|
"cfgBldDir=",
|
|
|
|
|
"prefix=",
|
|
|
|
|
"cmakeBuildConfiguration=",
|
|
|
|
|
"lldbLibDir=",
|
2017-02-04 08:20:24 +08:00
|
|
|
|
"argsFile",
|
|
|
|
|
"useSystemSix"]
|
2016-09-07 04:57:50 +08:00
|
|
|
|
dictArgReq = {"-h": "o", # o = optional, m = mandatory
|
|
|
|
|
"-d": "o",
|
|
|
|
|
"-m": "o",
|
|
|
|
|
"--srcRoot": "m",
|
|
|
|
|
"--targetDir": "m",
|
|
|
|
|
"--cfgBldDir": "o",
|
|
|
|
|
"--prefix": "o",
|
|
|
|
|
"--cmakeBuildConfiguration": "o",
|
|
|
|
|
"--lldbLibDir": "o",
|
2017-02-04 08:20:24 +08:00
|
|
|
|
"--argsFile": "o",
|
|
|
|
|
"--useSystemSix": "o"}
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Check for mandatory parameters
|
2015-11-06 07:57:33 +08:00
|
|
|
|
nResult, dictArgs, strMsg = utilsArgsParse.parse(vArgv, strListArgs,
|
|
|
|
|
listLongArgs,
|
|
|
|
|
dictArgReq,
|
|
|
|
|
strHelpInfo)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
if nResult < 0:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit_on_failure(nResult, strMsg)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# User input -h for help
|
|
|
|
|
if nResult == 1:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit_success(0, strMsg)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
return (nResult, dictArgs)
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Locate post process script language directory and the script within
|
|
|
|
|
# and execute.
|
|
|
|
|
# Args: vStrScriptLang - (R) Name of the script language to build.
|
|
|
|
|
# vstrFinishFileName - (R) Prefix file name to build full name.
|
|
|
|
|
# vDictArgs - (R) Program input parameters.
|
|
|
|
|
# Returns: Int - 0 = Success, < 0 some error condition.
|
|
|
|
|
# Str - Error message.
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def run_post_process(vStrScriptLang, vstrFinishFileName, vDictArgs):
|
|
|
|
|
dbg = utilsDebug.CDebugFnVerbose("run_post_process()")
|
|
|
|
|
nResult = 0
|
|
|
|
|
strStatusMsg = ""
|
|
|
|
|
strScriptFile = vstrFinishFileName % vStrScriptLang
|
2016-09-07 04:57:50 +08:00
|
|
|
|
strScriptFileDir = os.path.normpath(
|
|
|
|
|
os.path.join(
|
|
|
|
|
vDictArgs["--srcRoot"],
|
|
|
|
|
"scripts",
|
|
|
|
|
vStrScriptLang))
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strScriptFilePath = os.path.join(strScriptFileDir, strScriptFile)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Check for the existence of the script file
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strPath = os.path.normcase(strScriptFilePath)
|
|
|
|
|
bOk = os.path.exists(strPath)
|
2016-09-07 04:57:50 +08:00
|
|
|
|
if not bOk:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strDir = os.path.normcase(strScriptFileDir)
|
|
|
|
|
strStatusMsg = strScriptNotFound % (strScriptFile, strDir)
|
|
|
|
|
return (-9, strStatusMsg)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
if gbDbgFlag:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
print((strScriptLangFound % vStrScriptLang))
|
|
|
|
|
print((strExecuteMsg % vStrScriptLang))
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Change where Python looks for our modules
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strDir = os.path.normcase(strScriptFileDir)
|
|
|
|
|
sys.path.append(strDir)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Execute the specific language script
|
2016-09-07 04:57:50 +08:00
|
|
|
|
dictArgs = vDictArgs # Remove any args not required before passing on
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strModuleName = strScriptFile[: strScriptFile.__len__() - 3]
|
|
|
|
|
module = __import__(strModuleName)
|
|
|
|
|
nResult, strStatusMsg = module.main(dictArgs)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Revert sys path
|
2015-11-06 07:57:33 +08:00
|
|
|
|
sys.path.remove(strDir)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
return (nResult, strStatusMsg)
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Step through each script language sub directory supported
|
|
|
|
|
# and execute post processing script for each scripting language,
|
|
|
|
|
# make sure the build script for that language exists.
|
|
|
|
|
# For now the only language we support is Python, but we expect this
|
|
|
|
|
# to change.
|
|
|
|
|
# Args: vDictArgs - (R) Program input parameters.
|
|
|
|
|
# Returns: Int - 0 = Success, < 0 some error condition.
|
|
|
|
|
# Str - Error message.
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def run_post_process_for_each_script_supported(vDictArgs):
|
2016-09-07 04:57:50 +08:00
|
|
|
|
dbg = utilsDebug.CDebugFnVerbose(
|
|
|
|
|
"run_post_process_for_each_script_supported()")
|
2015-11-06 07:57:33 +08:00
|
|
|
|
nResult = 0
|
|
|
|
|
strStatusMsg = ""
|
2016-09-07 04:57:50 +08:00
|
|
|
|
strScriptDir = os.path.normpath(
|
|
|
|
|
os.path.join(
|
|
|
|
|
vDictArgs["--srcRoot"],
|
|
|
|
|
"scripts"))
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strFinishFileName = "finishSwig%sLLDB.py"
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Check for the existence of the scripts folder
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strScriptsDir = os.path.normcase(strScriptDir)
|
|
|
|
|
bOk = os.path.exists(strScriptsDir)
|
2016-09-07 04:57:50 +08:00
|
|
|
|
if not bOk:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
return (-8, strScriptDirNotFound)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Look for any script language directories to build for
|
2015-11-26 01:49:47 +08:00
|
|
|
|
listDirs = ["Python"]
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Iterate script directory find any script language directories
|
|
|
|
|
for scriptLang in listDirs:
|
2015-10-07 05:11:28 +08:00
|
|
|
|
# __pycache__ is a magic directory in Python 3 that holds .pyc files
|
2015-11-25 07:11:54 +08:00
|
|
|
|
if scriptLang != "__pycache__" and scriptLang != "swig_bot_lib":
|
2015-11-06 07:57:33 +08:00
|
|
|
|
dbg.dump_text("Executing language script for \'%s\'" % scriptLang)
|
2016-09-07 04:57:50 +08:00
|
|
|
|
nResult, strStatusMsg = run_post_process(
|
|
|
|
|
scriptLang, strFinishFileName, vDictArgs)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
if nResult < 0:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
break
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
if nResult < 0:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
strTmp = strPostProcessError % scriptLang
|
|
|
|
|
strTmp += strStatusMsg
|
|
|
|
|
strStatusMsg = strTmp
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
return (nResult, strStatusMsg)
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#++---------------------------------------------------------------------------
|
2015-03-21 03:53:49 +08:00
|
|
|
|
# Details: Program's main() with arguments passed in from the command line.
|
|
|
|
|
# Program either exits normally or with error from this function -
|
|
|
|
|
# top most level function.
|
|
|
|
|
# Args: vArgv - (R) List of arguments and values.
|
|
|
|
|
# Returns: None
|
|
|
|
|
# Throws: None.
|
2014-07-02 01:57:19 +08:00
|
|
|
|
#--
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
def main(vArgv):
|
|
|
|
|
dbg = utilsDebug.CDebugFnVerbose("main()")
|
|
|
|
|
bOk = False
|
|
|
|
|
dictArgs = {}
|
|
|
|
|
nResult = 0
|
|
|
|
|
strMsg = ""
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# The validate arguments fn will exit the program if tests fail
|
2015-11-06 07:57:33 +08:00
|
|
|
|
nResult, dictArgs = validate_arguments(vArgv)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
eOSType = utilsOsType.determine_os_type()
|
2015-03-21 03:53:49 +08:00
|
|
|
|
if eOSType == utilsOsType.EnumOsType.Unknown:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit(-4, strMsgErrorOsTypeUnknown)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
global gbDbgFlag
|
|
|
|
|
gbDbgFlag = "-d" in dictArgs
|
2015-03-21 03:53:49 +08:00
|
|
|
|
if gbDbgFlag:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
print_out_input_parameters(dictArgs)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
# Check to see if we were called from the Makefile system. If we were, check
|
|
|
|
|
# if the caller wants SWIG to generate a dependency file.
|
|
|
|
|
# Not used in this program, but passed through to the language script file
|
|
|
|
|
# called by this program
|
2015-11-06 07:57:33 +08:00
|
|
|
|
global gbMakeFileFlag
|
|
|
|
|
gbMakeFileFlag = "-m" in dictArgs
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
nResult, strMsg = run_post_process_for_each_script_supported(dictArgs)
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit(nResult, strMsg)
|
2014-07-02 01:57:19 +08:00
|
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
|
# TAG_PROGRAM_HELP_INFO
|
2015-03-21 03:53:49 +08:00
|
|
|
|
""" Details: Program main entry point.
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------
|
|
|
|
|
Args: -h (optional) Print help information on this program.
|
|
|
|
|
-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.
|
|
|
|
|
--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.
|
|
|
|
|
--cmakeBuildConfiguration= (optional) Is the build configuration(Debug, Release, RelWithDebugInfo)\n\
|
|
|
|
|
used to determine where the bin and lib directories are \n\
|
|
|
|
|
created for a Windows build.\n\
|
2016-04-26 04:34:34 +08:00
|
|
|
|
--lldbLibDir= The name of the directory containing liblldb.so.
|
|
|
|
|
(optional) "lib" by default.
|
2015-03-21 03:53:49 +08:00
|
|
|
|
--argsFile= The args are read from a file instead of the
|
|
|
|
|
command line. Other command line args are ignored.
|
2017-02-04 08:20:24 +08:00
|
|
|
|
--useSystemSix Use system six.py version.
|
2015-03-21 03:53:49 +08:00
|
|
|
|
Usage:
|
|
|
|
|
finishSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath
|
2016-04-26 04:34:34 +08:00
|
|
|
|
--cfgBldDir=ADirPath --prefix=ADirPath --lldbLibDir=ADirPath -m -d
|
2017-02-04 08:20:24 +08:00
|
|
|
|
--useSystemSix
|
2015-03-21 03:53:49 +08:00
|
|
|
|
|
|
|
|
|
Results: 0 Success
|
|
|
|
|
-1 Error - invalid parameters passed.
|
|
|
|
|
-2 Error - incorrect number of mandatory parameters passed.
|
|
|
|
|
|
|
|
|
|
-4 Error - unable to determine OS type.
|
|
|
|
|
-5 Error - program not run with name of "__main__".
|
|
|
|
|
-8 Error - unable to locate the scripts folder.
|
|
|
|
|
-9 Error - unable to locate the post process language script
|
|
|
|
|
file.
|
|
|
|
|
|
|
|
|
|
-100+ - Error messages from the child language script file.
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------
|
|
|
|
|
|
2014-07-02 01:57:19 +08:00
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# Called using "__main__" when not imported i.e. from the command line
|
|
|
|
|
if __name__ == "__main__":
|
2015-11-06 07:57:33 +08:00
|
|
|
|
utilsDebug.CDebugFnVerbose.bVerboseOn = gbDbgVerbose
|
|
|
|
|
dbg = utilsDebug.CDebugFnVerbose("__main__")
|
|
|
|
|
main(sys.argv[1:])
|
2014-07-02 01:57:19 +08:00
|
|
|
|
else:
|
2015-11-06 07:57:33 +08:00
|
|
|
|
program_exit(-5, strMsgErrorNoMain)
|