blob: d0668ccdea088cb32e6861cda74b583aed571dff [file] [log] [blame]
Deepak Panickal9b35cf52014-07-01 17:57:19 +00001""" SWIG creates Python C++ Script Bridge wrapper code Windows/LINUX/OSX platform
2
3 --------------------------------------------------------------------------
4 File: buildSwigWrapperClasses.py
5
6 Overview: Python script(s) to build the SWIG Python C++ Script
7 Bridge wrapper code on the Windows/LINUX/OSX platform.
8 The Python scripts are equivalent to the shell script (.sh)
9 files.
10 For each scripting language lib lldb supports, we need to
11 create the appropriate Script Bridge wrapper classes for
12 that language so that users can call Script Bridge
13 functions from within the script interpreter.
14 We use SWIG to help create the appropriate wrapper
15 classes/functions for the scripting language. In some
16 cases the file generated by SWIG may need some tweaking
17 before it is completely ready to use.
18
19 Environment: OS: Windows Vista or newer,LINUX,OSX.
20 IDE: Visual Studio 2013 Plugin Python Tools (PTVS)
21 Script: Python 2.6/2.7.5 x64
22 Other: SWIG 2.0.11
23
24 Gotchas: For Windows OS it is assumed the SWIG executable can be
25 found in the %PATH% environmental variable.
26
27 Copyright: None.
28 --------------------------------------------------------------------------
29
30"""
31
32# Python modules:
33import sys # Provide argument parsing
34import os # Provide directory and file handling
35
36# Third party modules:
37
38# In-house modules:
39import utilsArgsParse # Parse and validate this script's input arguments
40import utilsOsType # Determine the OS type this script is running on
41import utilsDebug # Debug Python scripts
42
43# Instantiations:
44gbDbgVerbose = False; # True = Turn on script function tracing, False = off.
45gbDbgFlag = False; # Global debug mode flag, set by input parameter
46 # --dbgFlag. True = operate in debug mode.
47gbMakeFileFlag = False; # True = yes called from makefile system, False = not.
48gbSwigGenDepFileFlag = False; # True = SWIG generate a dependency file.
49
50# User facing text:
51strMsgErrorNoMain = "Program called by another Python script not allowed";
52strExitMsgSuccess = "Program successful";
53strExitMsgError = "Program error: ";
54strParameter = "Parameter: ";
55strMsgErrorOsTypeUnknown = "Unable to determine OS type"
56strSwigFileFound = "Found the \'lldb.swig\' file\n";
57strSwigFileFoundNotFound = "Unable to locate the file \'%s\'"
58strSwigExeFileNotFound = "Unable to locate the SWIG executable file \'swig\'";
59strSwigScriptDirNotFound = "Unable to locate the SWIG script directory \'/script\'";
60strSwigScriptNotFound = "Unable to locate the SWIG script file \'%s\' in \'%s\'. Is it a script directory?";
61strSwigScriptLangFound = "Found \'%s\' build script.";
62strSwigScriptLangsFound = "Found the following script languages:";
63strSwigExecuteMsg = "Executing \'%s\' build script...";
64strSwigExecuteError = "Executing \'%s\' build script failed: ";
65strHelpInfo = "\
66Python script(s) to build the SWIG Python C++ Script \n\
67Bridge wrapper code on various platforms. The Python \n\
68scripts are equivalent to the shell script (.sh) files \n\
69run on others platforms.\n\
70Args: -h (optional) Print help information on this program.\n\
71 -d (optional) Determines whether or not this script\n\
72 outputs additional information when running.\n\
73 -m (optional) Specify called from Makefile system.\n\
74 -M (optional) Specify want SWIG to generate a dependency \n\
75 file.\n\
76 --srcRoot= The root of the lldb source tree.\n\
77 --targetDir= Where the lldb framework/shared library gets put.\n\
78 --cfgBldDir= (optional) Where the build-swig-Python-LLDB.py program \n\
79 will put the lldb.py file it generated from running\n\
80 SWIG.\n\
81 --prefix= (optional) Is the root directory used to determine where\n\
82 third-party modules for scripting languages should\n\
83 be installed. Where non-Darwin systems want to put\n\
84 the .py and .so files so that Python can find them\n\
85 automatically. Python install directory.\n\
86 --argsFile= The args are read from a file instead of the\n\
87 command line. Other command line args are ignored.\n\
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +000088 --swigExecutable= (optional) Full path of swig executable.\n\
Deepak Panickal9b35cf52014-07-01 17:57:19 +000089\n\
90Usage:\n\
91 buildSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath\n\
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +000092 --cfgBldDir=ADirPath --prefix=ADirPath --swigExecutable=ADirPath -m -d\n\
Deepak Panickal9b35cf52014-07-01 17:57:19 +000093\n\
94"; #TAG_PROGRAM_HELP_INFO
95strHelpInfoExtraWindows = "\
96On the Windows platform the PATH environmental variable needs to be \n\
97extended to include the installed SWIG executable path so it can be \n\
98be found by this Python script. The SWIG executable name is 'swig'."
99strHelpInfoExtraNonWindows = "\
100This Python script looks for the SWIG executable 'swig' in the following \n\
101directories '/usr/bin', '/usr/local/bin'. If not found the script will \n\
102abort.";
103
104#++---------------------------------------------------------------------------
105# Details: Retrieve the script -h help information based on the OS currently.
106# Args: None.
107# Returns: Str - Help Text.
108# Throws: None.
109#--
110def get_help_information():
111 strHelpMsg = strHelpInfo;
112
113 eOSType = utilsOsType.determine_os_type();
114 if eOSType == utilsOsType.EnumOsType.Windows:
115 strHelpMsg += strHelpInfoExtraWindows;
116 else:
117 strHelpMsg += strHelpInfoExtraNonWindows;
118
119 return strHelpMsg;
120
121#++---------------------------------------------------------------------------
122# Details: Exit the program on success. Called on program successfully done
123# its work. Returns a status result to the caller.
124# Args: vnResult - (R) 0 or greater indicating success.
125# vMsg - (R) Success message if any to show success to user.
126# Returns: None.
127# Throws: None.
128#--
129def program_exit_success( vnResult, vMsg ):
130 strMsg = "";
131
132 if vMsg.__len__() == 0:
133 strMsg = "%s (%d)" % (strExitMsgSuccess, vnResult);
134 else:
135 strMsg = "%s: %s (%d)" % (strExitMsgSuccess, vMsg, vnResult);
136 print strMsg;
137
138 sys.exit( vnResult );
139
140#++---------------------------------------------------------------------------
141# Details: Exit the program with error. Called on exit program failed its
142# task. Returns a status result to the caller.
143# Args: vnResult - (R) A negative number indicating error condition.
144# vMsg - (R) Error message to show to user.
145# Returns: None.
146# Throws: None.
147#--
148def program_exit_on_failure( vnResult, vMsg ):
149 print "%s%s (%d)" % (strExitMsgError, vMsg, vnResult);
150 sys.exit( vnResult );
151
152#++---------------------------------------------------------------------------
153# Details: Exit the program return a exit result number and print a message.
154# Positive numbers and zero are returned for success other error
155# occurred.
156# Args: vnResult - (R) A -ve (an error), 0 or +ve number (ok or status).
157# vMsg - (R) Error message to show to user.
158# Returns: None.
159# Throws: None.
160#--
161def program_exit( vnResult, vMsg ):
162 if vnResult >= 0:
163 program_exit_success( vnResult, vMsg );
164 else:
165 program_exit_on_failure( vnResult, vMsg );
166
167#++---------------------------------------------------------------------------
168# Details: Dump input parameters.
169# Args: vDictArgs - (R) Map of input args to value.
170# Returns: None.
171# Throws: None.
172#--
173def print_out_input_parameters( vDictArgs ):
174 for arg, val in vDictArgs.iteritems():
175 strEqs = "";
176 strQ = "";
177 if val.__len__() != 0:
178 strEqs = " =";
179 strQ = "\"";
180 print "%s%s%s %s%s%s\n" % (strParameter, arg, strEqs, strQ, val, strQ);
181
182#++---------------------------------------------------------------------------
183# Details: Locate the lldb.swig file. No checking for path correctness is
184# done here as assumed all values checked already. Path is adapted
185# to be compatible with the platform file system.
186# Args: vstrSrcRoot - (R) Directory path to the lldb source root.
187# veOSType - (R) Current OS type enumeration.
188# Returns: Bool - True = Success.
189# - False = Failure file not found.
190# Str - Error message.
191# Throws: None.
192#--
193def check_lldb_swig_file_exists( vstrSrcRoot, veOSType ):
194 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_file_exists()" );
195 bOk = True;
196 strStatusMsg = "";
197 strSwigFilePathName = "/scripts/lldb.swig";
198
199 strFullPath = os.path.normcase( vstrSrcRoot + strSwigFilePathName );
200 bOk = os.path.isfile( strFullPath );
201 if bOk:
202 if gbDbgFlag:
203 print strSwigFileFound;
204 else:
205 strStatusMsg = strSwigFileFoundNotFound % strFullPath;
206
207 return (bOk, strStatusMsg);
208
209#++---------------------------------------------------------------------------
210# Details: Locate SWIG sub script language directory and the script within
211# and execute SWIG for that script language.
212# Args: vStrScriptLang - (R) Name of the script language to build.
213# vSwigBuildFileName - (R) Prefix file name to build full name.
214# vDictArgs - (R) Program input parameters.
215# Returns: Int - 0 = Success, < 0 some error condition.
216# Str - Error message.
217# Throws: None.
218#--
219def run_swig( vStrScriptLang, vSwigBuildFileName, vDictArgs ):
220 dbg = utilsDebug.CDebugFnVerbose( "run_swig()" );
221 nResult = 0;
222 strStatusMsg = "";
223 strScriptFile = vSwigBuildFileName % vStrScriptLang;
224 strScriptFileDir = "%s%s/%s" % (vDictArgs[ "--srcRoot" ], "/scripts",
225 vStrScriptLang);
226 strScriptFilePath = "%s/%s" % (strScriptFileDir, strScriptFile);
227
228 # Check for the existence of the script file
229 strPath = os.path.normcase( strScriptFilePath );
230 bOk = os.path.exists( strPath );
231 if bOk == False:
232 strDir = os.path.normcase( strScriptFileDir );
233 strStatusMsg = strSwigScriptNotFound % (strScriptFile, strDir);
234 return (-9, strStatusMsg);
235
236 if gbDbgFlag:
237 print strSwigScriptLangFound % vStrScriptLang;
238 print strSwigExecuteMsg % vStrScriptLang;
239
240 # Change where Python looks for our modules
241 strDir = os.path.normcase( strScriptFileDir );
242 sys.path.append( strDir );
243
244 # Execute the specific language script
245 dictArgs = vDictArgs; # Remove any args not required before passing on
246 strModuleName = strScriptFile[ : strScriptFile.__len__() - 3 ];
247 module = __import__( strModuleName );
248 nResult, strStatusMsg = module.main( dictArgs );
249
250 # Revert sys path
251 sys.path.remove( strDir );
252
253 return (nResult, strStatusMsg);
254
255#++---------------------------------------------------------------------------
256# Details: Step through each SWIG sub directory script language supported
257# type and execute SWIG to build wrapper code based on that language.
258# If an error occurs for a build this function will return with an
259# error and not continue with proceed script builds.
260# For each scripting language, make sure the build script for that
261# language exists.
262# For now the only language we support is Python, but we expect this
263# to change.
264# Args: vDictArgs - (R) Program input parameters.
265# Returns: Int - 0 = Success, < 0 some error condition.
266# Str - Error message.
267# Throws: None.
268#--
269def run_swig_for_each_script_supported( vDictArgs ):
270 dbg = utilsDebug.CDebugFnVerbose( "run_swig_for_each_script_supported()" );
271 nResult = 0;
272 strStatusMsg = "";
273 strSwigScriptDir = vDictArgs[ "--srcRoot" ] + "/scripts";
274 strSwigBuildFileName = "buildSwig%s.py";
275
276 # Check for the existence of the SWIG scripts folder
277 strScriptsDir = os.path.normcase( strSwigScriptDir );
278 bOk = os.path.exists( strScriptsDir );
279 if bOk == False:
280 return (-8, strSwigScriptDirNotFound);
281
282 # Look for any script language directories to build for
283 listDirs = [];
284 nDepth = 1;
285 for strPath, listDirs, listFiles in os.walk( strSwigScriptDir ):
286 nDepth = nDepth - 1;
287 if nDepth == 0:
288 break;
289
290 if gbDbgFlag:
291 print strSwigScriptLangsFound,
292 for dir in listDirs:
293 print dir,
294 print "\n";
295
296 # Iterate script directory find any script language directories
297 for scriptLang in listDirs:
298 dbg.dump_text( "Executing language script for \'%s\'" % scriptLang );
299 nResult, strStatusMsg = run_swig( scriptLang, strSwigBuildFileName,
300 vDictArgs );
301 if nResult < 0:
302 break;
303
304 if nResult < 0:
305 strTmp = strSwigExecuteError % scriptLang;
306 strTmp += strStatusMsg;
307 strStatusMsg = strTmp;
308
309 return (nResult, strStatusMsg);
310
311#++---------------------------------------------------------------------------
312# Details: Dummy function - system unknown. Function should not be called.
313# Args: vDictArgs - (R) Program input parameters.
314# Returns: Bool - False = Program logic error.
315# Str - Error message.
316# Throws: None.
317#--
318def check_lldb_swig_executable_file_exists_Unknown( vDictArgs ):
319 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists_Unknown()" );
320 # Do nothing
321 return (False, strMsgErrorOsTypeUnknown);
322
323#++---------------------------------------------------------------------------
324# Details: Locate the SWIG executable file in a Windows system. Several hard
325# coded predetermined possible file path locations are searched.
326# (This is good candidate for a derived class object)
327# Args: vDictArgs - (W) Program input parameters.
328# Returns: Bool - True = Success.
329# - False = Failure file not found.
330# Str - Error message.
331# Throws: None.
332#--
Zachary Turnerca0c84c2014-11-17 18:38:22 +0000333def check_lldb_swig_executable_file_exists_Windows( vDictArgs ):
334 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists_Windows()" );
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000335
336 # Will always be true as it assumed the path to SWIG executable will be
337 # in the OS system environmental variable %PATH%. Easier this way as the
338 # user may have renamed the directory and or custom path installation.
339 bExeFileFound = True;
340 vDictArgs[ "--swigExePath" ] = "";
341 vDictArgs[ "--swigExeName" ] = "swig.exe";
342 return (bExeFileFound, None);
343
344#++---------------------------------------------------------------------------
345# Details: Locate the SWIG executable file in a Linux system. Several hard
346# coded predetermined possible file path locations are searched.
347# (This is good candidate for a derived class object)
348# Args: vDictArgs - (W) Program input parameters.
349# Returns: Bool - True = Success.
350# - False = Failure file not found.
351# Str - Error message.
352# Throws: None.
353#--
354def check_lldb_swig_executable_file_exists_Linux( vDictArgs ):
355 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists_Linux()" );
356 bExeFileFound = False;
357
358 strSwigExe = "swig";
359 strSwigExePath = "/usr/bin";
360 strExe = os.path.normcase( "%s/%s" % (strSwigExePath, strSwigExe) );
361 if os.path.isfile( strExe ) and os.access( strExe, os.X_OK ):
362 bExeFileFound = True;
363 vDictArgs[ "--swigExePath" ] = os.path.normcase( strSwigExePath );
364 vDictArgs[ "--swigExeName" ] = strSwigExe;
365 return (bExeFileFound, None);
366
367 strSwigExePath = "/usr/local/bin";
368 strExe = os.path.normcase( "%s/%s" % (strSwigExePath, strSwigExe) );
369 if os.path.isfile( strExe ) and os.access( strExe, os.X_OK ):
370 bExeFileFound = True;
371 vDictArgs[ "--swigExePath" ] = os.path.normcase( strSwigExePath );
372 vDictArgs[ "--swigExeName" ] = strSwigExe;
373 return (bExeFileFound, None);
374
375 return (bExeFileFound, strSwigExeFileNotFound);
376
377#++---------------------------------------------------------------------------
378# Details: Locate the SWIG executable file in a OSX system. Several hard
379# coded predetermined possible file path locations are searched.
380# (This is good candidate for a derived class object)
381# Args: vDictArgs - (W) Program input parameters.
382# Returns: Bool - True = Success.
383# - False = Failure file not found.
384# Str - Error message.
385# Throws: None.
386#--
387def check_lldb_swig_executable_file_exists_Darwin( vDictArgs ):
388 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists_Darwin()" );
389 bExeFileFound = False;
390 # ToDo: Find the SWIG executable and add the path to the args dictionary
391 #vDictArgs.[ "--swigExePath" ] = "/usr/bin/swig";
392 strStatusMsg = "Sorry function 'check_lldb_swig_executable_file_exists_Darwin()' is not implemented";
393
394 return (bExeFileFound, strStatusMsg);
Zachary Turnerca0c84c2014-11-17 18:38:22 +0000395
396#++---------------------------------------------------------------------------
397# Details: Locate the SWIG executable file in a OSX system. Several hard
398# coded predetermined possible file path locations are searched.
399# (This is good candidate for a derived class object)
400# Args: vDictArgs - (W) Program input parameters.
401# Returns: Bool - True = Success.
402# - False = Failure file not found.
403# Str - Error message.
404# Throws: None.
405#--
406def check_lldb_swig_executable_file_exists_FreeBSD( vDictArgs ):
407 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists_FreeBSD()" );
408 bExeFileFound = False;
409 # ToDo: Find the SWIG executable and add the path to the args dictionary
410 #vDictArgs.[ "--swigExePath" ] = "/usr/bin/swig";
411 strStatusMsg = "Sorry function 'check_lldb_swig_executable_file_exists_FreeBSD()' is not implemented";
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000412
Zachary Turnerca0c84c2014-11-17 18:38:22 +0000413 return (bExeFileFound, strStatusMsg);
414
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000415#++---------------------------------------------------------------------------
416# Details: Locate the SWIG executable file. Several hard coded predetermined
417# possible file path locations are searched.
418# Args: vDictArgs - (RW) Program input parameters.
419# veOSType - (R) Current OS type enumeration.
420# Returns: Bool - True = Success.
421# - False = Failure file not found.
422# Str - Error message.
423# Throws: None.
424#--
425def check_lldb_swig_executable_file_exists( vDictArgs, veOSType ):
426 dbg = utilsDebug.CDebugFnVerbose( "check_lldb_swig_executable_file_exists()" );
427 bExeFileFound = False;
428 strStatusMsg = "";
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +0000429 if "--swigExecutable" in vDictArgs:
430 vDictArgs["--swigExeName"] = os.path.basename(vDictArgs["--swigExecutable"])
431 vDictArgs["--swigExePath"] = os.path.dirname(vDictArgs["--swigExecutable"])
432 bExeFileFound = True
433 else:
434 from utilsOsType import EnumOsType;
435 switch = { EnumOsType.Unknown : check_lldb_swig_executable_file_exists_Unknown,
Zachary Turnerca0c84c2014-11-17 18:38:22 +0000436 EnumOsType.Darwin : check_lldb_swig_executable_file_exists_Darwin,
437 EnumOsType.FreeBSD : check_lldb_swig_executable_file_exists_FreeBSD,
438 EnumOsType.Linux : check_lldb_swig_executable_file_exists_Linux,
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +0000439 EnumOsType.Windows : check_lldb_swig_executable_file_exists_Windows }
440 bExeFileFound, strStatusMsg = switch[ veOSType ]( vDictArgs );
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000441 return (bExeFileFound, strStatusMsg);
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000442#++---------------------------------------------------------------------------
443# Details: Validate the arguments passed to the program. This function exits
444# the program should error with the arguments be found.
445# Args: vArgv - (R) List of arguments and values.
446# Returns: Int - 0 = success, -ve = some failure.
447# Dict - Map of arguments names to argument values
448# Throws: None.
449#--
450def validate_arguments( vArgv ):
451 dbg = utilsDebug.CDebugFnVerbose( "validate_arguments()" );
452 strMsg = "";
453 dictArgs = {};
454 nResult = 0;
455 strListArgs = "hdmM"; # Format "hiox:" = -h -i -o -x <arg>
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +0000456 listLongArgs = ["srcRoot=", "targetDir=", "cfgBldDir=", "prefix=",
457 "swigExecutable=", "argsFile"];
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000458 dictArgReq = { "-h": "o", # o = optional, m = mandatory
459 "-d": "o",
460 "-m": "o",
461 "-M": "o",
462 "--srcRoot": "m",
463 "--targetDir": "m",
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +0000464 "--swigExecutable" : "o",
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000465 "--cfgBldDir": "o",
466 "--prefix": "o",
467 "--argsFile": "o" };
468 strHelpInfo = get_help_information();
469
470 # Check for mandatory parameters
471 nResult, dictArgs, strMsg = utilsArgsParse.parse( vArgv, strListArgs,
472 listLongArgs,
473 dictArgReq,
474 strHelpInfo );
475 if nResult < 0:
476 program_exit_on_failure( nResult, strMsg );
477
478 # User input -h for help
479 if nResult == 1:
480 program_exit_success( 0, strMsg );
481
482 return (nResult, dictArgs);
483
484#++---------------------------------------------------------------------------
485# Details: Program's main() with arguments passed in from the command line.
486# Program either exits normally or with error from this function -
487# top most level function.
488# Args: vArgv - (R) List of arguments and values.
489# Returns: None
490# Throws: None.
491#--
492def main( vArgv ):
493 dbg = utilsDebug.CDebugFnVerbose( "main()" );
494 bOk = False;
495 dictArgs = {};
496 nResult = 0;
497 strMsg = "";
498
499 # The validate arguments fn will exit the program if tests fail
500 nResult, dictArgs = validate_arguments( vArgv );
501
502 eOSType = utilsOsType.determine_os_type();
503 if eOSType == utilsOsType.EnumOsType.Unknown:
504 program_exit( -4, strMsgErrorOsTypeUnknown );
505
506 global gbDbgFlag;
507 gbDbgFlag = dictArgs.has_key( "-d" );
508 if gbDbgFlag:
509 print_out_input_parameters( dictArgs );
510
511 # Check to see if we were called from the Makefile system. If we were, check
512 # if the caller wants SWIG to generate a dependency file.
513 # Not used in this program, but passed through to the language script file
514 # called by this program
515 global gbMakeFileFlag;
516 global gbSwigGenDepFileFlag;
517 gbMakeFileFlag = dictArgs.has_key( "-m" );
518 gbSwigGenDepFileFlag = dictArgs.has_key( "-M" );
519
520 bOk, strMsg = check_lldb_swig_file_exists( dictArgs[ "--srcRoot" ], eOSType );
521 if bOk == False:
522 program_exit( -3, strMsg );
523
524 bOk, strMsg = check_lldb_swig_executable_file_exists( dictArgs, eOSType );
525 if bOk == False:
526 program_exit( -6, strMsg );
527
528 nResult, strMsg = run_swig_for_each_script_supported( dictArgs );
529
530 program_exit( nResult, strMsg );
531
532#-----------------------------------------------------------------------------
533#-----------------------------------------------------------------------------
534#-----------------------------------------------------------------------------
535
536#TAG_PROGRAM_HELP_INFO
537""" Details: Program main entry point.
538
539 --------------------------------------------------------------------------
540 Args: -h (optional) Print help information on this program.
541 -d (optional) Determines whether or not this script
542 outputs additional information when running.
543 -m (optional) Specify called from Makefile system. If given locate
544 the LLDBWrapPython.cpp in --srcRoot/source folder
545 else in the --targetDir folder.
546 -M (optional) Specify want SWIG to generate a dependency file.
547 --srcRoot= The root of the lldb source tree.
548 --targetDir= Where the lldb framework/shared library gets put.
549 --cfgBldDir= Where the buildSwigPythonLLDB.py program will
550 (optional) put the lldb.py file it generated from running
551 SWIG.
552 --prefix= Is the root directory used to determine where
553 (optional) third-party modules for scripting languages should
554 be installed. Where non-Darwin systems want to put
555 the .py and .so files so that Python can find them
556 automatically. Python install directory.
557 --argsFile= The args are read from a file instead of the
558 command line. Other command line args are ignored.
559 Usage:
Ismail Pazarbasicc7d7f52014-11-18 21:46:06 +0000560 buildSwigWrapperClasses.py --srcRoot=ADirPath --targetDir=ADirPath
561 --cfgBldDir=ADirPath --prefix=ADirPath --swigExecutable=ADirPath -m -d
Deepak Panickal9b35cf52014-07-01 17:57:19 +0000562
563 Results: 0 Success
564 -1 Error - invalid parameters passed.
565 -2 Error - incorrect number of mandatory parameters passed.
566 -3 Error - unable to locate lldb.swig file.
567 -4 Error - unable to determine OS type.
568 -5 Error - program called by another Python script not allowed.
569 -6 Error - unable to locate the swig executable file.
570 -7 Error - SWIG script execution failed.
571 -8 Error - unable to locate the SWIG scripts folder.
572 -9 Error - unable to locate the SWIG language script file.
573 -100+ - Error messages from the SWIG language script file.
574 -200+ - 200 +- the SWIG exit result.
575 --------------------------------------------------------------------------
576
577"""
578
579# Called using "__main__" when not imported i.e. from the command line
580if __name__ == "__main__":
581 utilsDebug.CDebugFnVerbose.bVerboseOn = gbDbgVerbose;
582 dbg = utilsDebug.CDebugFnVerbose( "__main__" );
583 main( sys.argv[ 1: ] );
584else:
585 program_exit( -5, strMsgErrorNoMain );