Example #1
0
def make_symlink_native(vDictArgs, strSrc, strTarget):
    eOSType = utilsOsType.determine_os_type()
    bDbg = "-d" in vDictArgs
    bOk = True
    strErrMsg = ""

    target_filename = os.path.basename(strTarget)
    if eOSType == utilsOsType.EnumOsType.Unknown:
        bOk = False
        strErrMsg = strErrMsgOsTypeUnknown
    elif eOSType == utilsOsType.EnumOsType.Windows:
        if bDbg:
            print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
        bOk, strErrMsg = make_symlink_windows(strSrc,
                                              strTarget)
    else:
        if os.path.islink(strTarget):
            if bDbg:
                print((strMsgSymlinkExists % target_filename))
            return (bOk, strErrMsg)
        if bDbg:
            print((strMsgSymlinkMk % (target_filename, strSrc, strTarget)))
        bOk, strErrMsg = make_symlink_other_platforms(strSrc,
                                                      strTarget)

    return (bOk, strErrMsg)
Example #2
0
def make_symlink(
        vDictArgs,
        vstrFrameworkPythonDir,
        vstrSrcFile,
        vstrTargetFile):
    dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink()")
    bOk = True
    strErrMsg = ""
    bDbg = "-d" in vDictArgs
    strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
    strTarget = os.path.normcase(strTarget)
    strSrc = ""

    os.chdir(vstrFrameworkPythonDir)
    bMakeFileCalled = "-m" in vDictArgs
    eOSType = utilsOsType.determine_os_type()
    if not bMakeFileCalled:
        strBuildDir = os.path.join("..", "..", "..")
    else:
        # Resolve vstrSrcFile path relatively the build directory
        if eOSType == utilsOsType.EnumOsType.Windows:
            # On a Windows platform the vstrFrameworkPythonDir looks like:
            # llvm\\build\\Lib\\site-packages\\lldb
            strBuildDir = os.path.join("..", "..", "..")
        else:
            # On a UNIX style platform the vstrFrameworkPythonDir looks like:
            # llvm/build/lib/python2.7/site-packages/lldb
            strBuildDir = os.path.join("..", "..", "..", "..")
    strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))

    return make_symlink_native(vDictArgs, strSrc, strTarget)
def main(vArgv):
    dbg = utilsDebug.CDebugFnVerbose("main()")
    bOk = False
    dictArgs = {}
    nResult = 0
    strMsg = ""

    # The validate arguments fn will exit the program if tests fail
    nResult, dictArgs = validate_arguments(vArgv)

    eOSType = utilsOsType.determine_os_type()
    if eOSType == utilsOsType.EnumOsType.Unknown:
        program_exit(-4, strMsgErrorOsTypeUnknown)

    global gbDbgFlag
    gbDbgFlag = "-d" in dictArgs
    if gbDbgFlag:
        print_out_input_parameters(dictArgs)

    # 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
    global gbMakeFileFlag
    global gbSwigGenDepFileFlag
    gbMakeFileFlag = "-m" in dictArgs
    gbSwigGenDepFileFlag = "-M" in dictArgs

    bOk, strMsg = check_lldb_swig_file_exists(dictArgs["--srcRoot"], eOSType)
    if bOk == False:
        program_exit(-3, strMsg)

    nResult, strMsg = run_swig_for_each_script_supported(dictArgs)

    program_exit(nResult, strMsg)
Example #4
0
def create_symlinks(vDictArgs, vstrFrameworkPythonDir, vstrLldbLibDir):
    dbg = utilsDebug.CDebugFnVerbose("Python script create_symlinks()")
    bOk = True
    strErrMsg = ""
    eOSType = utilsOsType.determine_os_type()

    # Make symlink for _lldb
    strLibLldbFileName = "_lldb"
    if bOk:
        bOk, strErrMsg = make_symlink_liblldb(vDictArgs,
                                              vstrFrameworkPythonDir,
                                              strLibLldbFileName,
                                              vstrLldbLibDir)

    # Make symlink for darwin-debug on Darwin
    strDarwinDebugFileName = "darwin-debug"
    if bOk and eOSType == utilsOsType.EnumOsType.Darwin:
        bOk, strErrMsg = make_symlink_darwin_debug(vDictArgs,
                                                   vstrFrameworkPythonDir,
                                                   strDarwinDebugFileName)

    # Make symlink for lldb-argdumper
    strArgdumperFileName = "lldb-argdumper"
    if bOk:
        bOk, strErrMsg = make_symlink_lldb_argdumper(vDictArgs,
                                                     vstrFrameworkPythonDir,
                                                     strArgdumperFileName)

    return (bOk, strErrMsg)
Example #5
0
def make_symlink_liblldb(vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName):
    dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_liblldb()")
    bOk = True
    strErrMsg = ""
    strTarget = vstrLiblldbFileName
    strSrc = ""

    eOSType = utilsOsType.determine_os_type()
    if eOSType == utilsOsType.EnumOsType.Windows:
        # When importing an extension module using a debug version of python, you
        # write, for example, "import foo", but the interpreter searches for
        # "foo_d.pyd"
        if is_debug_interpreter():
            strTarget += "_d"
        strTarget += ".pyd"
    else:
        strTarget += ".so"

    bMakeFileCalled = "-m" in vDictArgs
    if not bMakeFileCalled:
        strSrc = os.path.join("lib", "LLDB")
    else:
        strLibFileExtn = ""
        if eOSType == utilsOsType.EnumOsType.Windows:
            strSrc = os.path.join("bin", "liblldb.dll")
        else:
            if eOSType == utilsOsType.EnumOsType.Darwin:
                strLibFileExtn = ".dylib"
            else:
                strLibFileExtn = ".so"
            strSrc = os.path.join("lib", "liblldb" + strLibFileExtn)

    bOk, strErrMsg = make_symlink(vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget)

    return (bOk, strErrMsg)
def make_symlink_liblldb( vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName ):
    dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink_liblldb()" );
    bOk = True;
    strErrMsg = "";
    strTarget = vstrLiblldbFileName;
    strSrc = "";

    eOSType = utilsOsType.determine_os_type();
    if eOSType == utilsOsType.EnumOsType.Windows:
        # When importing an extension module using a debug version of python, you
        # write, for example, "import foo", but the interpreter searches for
        # "foo_d.pyd"
        if vDictArgs["--buildConfig"].lower() == "debug":
            strTarget += "_d";
        strTarget += ".pyd";
    else:
        strTarget += ".so";

    bMakeFileCalled = vDictArgs.has_key( "-m" );
    if not bMakeFileCalled:
        strSrc = os.path.join("lib", "LLDB");
    else:
        strLibFileExtn = "";
        if eOSType == utilsOsType.EnumOsType.Windows:
            strSrc = os.path.join("bin", "liblldb.dll");
        else:
            if eOSType == utilsOsType.EnumOsType.Darwin:
                strLibFileExtn = ".dylib";
            else:
                strLibFileExtn = ".so";
            strSrc = os.path.join("lib", "liblldb" + strLibFileExtn);

    bOk, strErrMsg = make_symlink( vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget );

    return (bOk, strErrMsg);
Example #7
0
def make_symlink_lldb_argdumper(
        vDictArgs,
        vstrFrameworkPythonDir,
        vstrArgdumperFileName):
    dbg = utilsDebug.CDebugFnVerbose(
        "Python script make_symlink_lldb_argdumper()")
    bOk = True
    strErrMsg = ""
    strTarget = vstrArgdumperFileName
    strSrc = ""

    eOSType = utilsOsType.determine_os_type()
    if eOSType == utilsOsType.EnumOsType.Windows:
        strTarget += ".exe"

    bMakeFileCalled = "-m" in vDictArgs
    if not bMakeFileCalled:
        return (bOk, strErrMsg)
    else:
        strExeFileExtn = ""
        if eOSType == utilsOsType.EnumOsType.Windows:
            strExeFileExtn = ".exe"
        strSrc = os.path.join("bin", "lldb-argdumper" + strExeFileExtn)

    bOk, strErrMsg = make_symlink(
        vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget)

    return (bOk, strErrMsg)
def main( vArgv ):
    dbg = utilsDebug.CDebugFnVerbose( "main()" );
    bOk = False;
    dictArgs = {};
    nResult = 0;
    strMsg = "";

    # The validate arguments fn will exit the program if tests fail
    nResult, dictArgs = validate_arguments( vArgv );

    eOSType = utilsOsType.determine_os_type();
    if eOSType == utilsOsType.EnumOsType.Unknown:
        program_exit( -4, strMsgErrorOsTypeUnknown );

    global gbDbgFlag;
    gbDbgFlag = dictArgs.has_key( "-d" );
    if gbDbgFlag:
        print_out_input_parameters( dictArgs );

    # 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
    global gbMakeFileFlag;
    gbMakeFileFlag = dictArgs.has_key( "-m" );

    nResult, strMsg = run_post_process_for_each_script_supported( dictArgs );

    program_exit( nResult, strMsg );
def get_help_information():
	strHelpMsg = strHelpInfo;
	
	eOSType = utilsOsType.determine_os_type();
	if eOSType == utilsOsType.EnumOsType.Windows:
		strHelpMsg += strHelpInfoExtraWindows;
	else:
		strHelpMsg += strHelpInfoExtraNonWindows;
	
	return strHelpMsg;
Example #10
0
def make_symlink( vDictArgs, vstrFrameworkPythonDir, vstrSrcFile, vstrTargetFile ):
    dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink()" );
    bOk = True;
    strErrMsg = "";
    bDbg = vDictArgs.has_key( "-d" );
    strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile);
    strTarget = os.path.normcase( strTarget );
    strSrc = "";

    os.chdir( vstrFrameworkPythonDir );
    bMakeFileCalled = vDictArgs.has_key( "-m" );
    eOSType = utilsOsType.determine_os_type();
    if not bMakeFileCalled:
        return (bOk, strErrMsg);
    else:
        # Resolve vstrSrcFile path relatively the build directory
        if eOSType == utilsOsType.EnumOsType.Windows:
            # On a Windows platform the vstrFrameworkPythonDir looks like:
            # llvm\\build\\Lib\\site-packages\\lldb
            strBuildDir = os.path.join("..", "..", "..");
        else:
            # On a UNIX style platform the vstrFrameworkPythonDir looks like:
            # llvm/build/lib/python2.7/site-packages/lldb
            strBuildDir = os.path.join("..", "..", "..", "..");
        strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile));
        strTargetDir = os.path.dirname(strTarget);
        strSrc = os.path.relpath(os.path.abspath(strSrc), strTargetDir);

    if eOSType == utilsOsType.EnumOsType.Unknown:
        bOk = False;
        strErrMsg = strErrMsgOsTypeUnknown;
    elif eOSType == utilsOsType.EnumOsType.Windows:
        if os.path.isfile( strTarget ):
            if bDbg:
                print strMsgSymlinkExists % vstrTargetFile;
            return (bOk, strErrMsg);
        if bDbg:
            print strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget);
        bOk, strErrMsg = make_symlink_windows( strSrc,
                                               strTarget );
    else:
        if os.path.islink( strTarget ):
            if bDbg:
                print strMsgSymlinkExists % vstrTargetFile;
            return (bOk, strErrMsg);
        if bDbg:
            print strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget);
        bOk, strErrMsg = make_symlink_other_platforms( strSrc,
                                                       strTarget );

    return (bOk, strErrMsg);
def make_symlink(vDictArgs, vstrFrameworkPythonDir):
    dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink()")
    bOk = True
    strWkDir = ""
    strErrMsg = ""
    strSoFileName = "_lldb"

    eOSType = utilsOsType.determine_os_type()
    if eOSType == utilsOsType.EnumOsType.Unknown:
        bOk = False
        strErrMsg = strErrMsgOsTypeUnknown
    elif eOSType == utilsOsType.EnumOsType.Windows:
        bOk, strErrMsg = make_symlink_windows(vDictArgs, vstrFrameworkPythonDir, strSoFileName)
    else:
        bOk, strErrMsg = make_symlink_other_platforms(vDictArgs, vstrFrameworkPythonDir, strSoFileName)
    return (bOk, strErrMsg)
Example #12
0
def get_framework_python_dir( vDictArgs ):
	dbg = utilsDebug.CDebugFnVerbose( "Python script get_framework_python_dir()" );
	bOk = True;
	strWkDir = "";
	strErrMsg = "";
	 
	eOSType = utilsOsType.determine_os_type();
	if eOSType == utilsOsType.EnumOsType.Unknown:
		bOk = False;
		strErrMsg = strErrMsgOsTypeUnknown;
	elif eOSType == utilsOsType.EnumOsType.Windows:
		bOk, strWkDir, strErrMsg = get_framework_python_dir_windows( vDictArgs );
	else:
		bOk, strWkDir, strErrMsg = get_framework_python_dir_other_platforms( vDictArgs );
			
	return (bOk, strWkDir, strErrMsg);
Example #13
0
def make_symlink_liblldb( vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName ):
    dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink_liblldb()" );
    bOk = True;
    strErrMsg = "";
    strTarget = vstrLiblldbFileName;
    strSrc = "";

    eOSType = utilsOsType.determine_os_type();
    if eOSType == utilsOsType.EnumOsType.Windows:
        # When importing an extension module using a debug version of python, you
        # write, for example, "import foo", but the interpreter searches for
        # "foo_d.pyd"
        if is_debug_interpreter():
            strTarget += "_d";
        strTarget += ".pyd";
    else:
        strTarget += ".so";

    bMakeFileCalled = vDictArgs.has_key( "-m" );
    if not bMakeFileCalled:
        strSrc = os.path.join("lib", "LLDB");
    else:
        strLibFileExtn = "";
        if eOSType == utilsOsType.EnumOsType.Windows:
            strSrc = os.path.join("bin", "liblldb.dll");
        else:
            if eOSType == utilsOsType.EnumOsType.Darwin:
                strLibFileExtn = ".dylib";
            else:
                strLibFileExtn = ".so";
            strSrc = os.path.join("lib", "liblldb" + strLibFileExtn);

    if eOSType != utilsOsType.EnumOsType.Windows:
        # Create a symlink to the "lib" directory, to ensure liblldb's RPATH is
        # effective.
        bOk, strErrMsg = make_symlink( vDictArgs, vstrFrameworkPythonDir, "lib", os.path.join("../lib") );
        if not bOk:
            return (bOk, strErrMsg)

    bOk, strErrMsg = make_symlink( vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget );

    return (bOk, strErrMsg);
def make_symlink_other_platforms(vDictArgs, vstrFrameworkPythonDir, vstrSoPath):
    dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink_other_platforms()")
    bOk = True
    strMsg = ""
    bDbg = vDictArgs.has_key("-d")
    strTarget = vstrSoPath + ".so"
    strSoPath = "%s/%s" % (vstrFrameworkPythonDir, strTarget)
    strTarget = os.path.normcase(strSoPath)
    strSrc = ""

    os.chdir(vstrFrameworkPythonDir)
    bMakeFileCalled = vDictArgs.has_key("-m")
    if not bMakeFileCalled:
        strSrc = os.path.normcase("../../../LLDB")
    else:
        strLibFileExtn = ""
        eOSType = utilsOsType.determine_os_type()
        if eOSType == utilsOsType.EnumOsType.Linux:
            strLibFileExtn = ".so"
        elif eOSType == utilsOsType.EnumOsType.Darwin:
            strLibFileExtn = ".dylib"
        strSrc = os.path.normcase("../../../liblldb%s" % strLibFileExtn)

    if os.path.islink(strTarget):
        if bDbg:
            print strMsglldbsoExists % strTarget
        return (bOk, strMsg)

    if bDbg:
        print strMsglldbsoMk

    try:
        os.symlink(strSrc, strTarget)
    except OSError as e:
        bOk = False
        strMsg = "OSError( %d ): %s %s" % (e.errno, e.strerror, strErrMsgMakeSymlink)
        strMsg += " Src:'%s' Target:'%s'" % (strSrc, strTarget)
    except:
        bOk = False
        strMsg = strErrMsgUnexpected % sys.exec_info()[0]

    return (bOk, strMsg)
Example #15
0
def make_symlink_argdumper( vDictArgs, vstrFrameworkPythonDir, vstrArgdumperFileName ):
    dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink_argdumper()" );
    bOk = True;
    strErrMsg = "";
    strTarget = vstrArgdumperFileName;
    strSrc = "";

    eOSType = utilsOsType.determine_os_type();
    if eOSType == utilsOsType.EnumOsType.Windows:
        strTarget += ".exe";

    bMakeFileCalled = vDictArgs.has_key( "-m" );
    if not bMakeFileCalled:
        return (bOk, strErrMsg);
    else:
        strExeFileExtn = "";
        if eOSType == utilsOsType.EnumOsType.Windows:
            strExeFileExtn = ".exe";
        strSrc = os.path.join("bin", "argdumper" + strExeFileExtn);

    bOk, strErrMsg = make_symlink( vDictArgs, vstrFrameworkPythonDir, strSrc, strTarget );

    return (bOk, strErrMsg);
def macosx_copy_file_for_heap(vDictArgs, vstrFrameworkPythonDir):
    dbg = utilsDebug.CDebugFnVerbose("Python script macosx_copy_file_for_heap()")
    bOk = True
    strMsg = ""

    eOSType = utilsOsType.determine_os_type()
    if eOSType != utilsOsType.EnumOsType.Darwin:
        return (bOk, strMsg)

    strHeapDir = vstrFrameworkPythonDir + "/macosx/heap"
    strHeapDir = os.path.normcase(strHeapDir)
    if os.path.exists(strHeapDir) and os.path.isdir(strHeapDir):
        return (bOk, strMsg)

    os.makedirs(strHeapDir)

    strRoot = vDictArgs["--srcRoot"]
    strSrc = strRoot + "/examples/darwin/heap_find/heap/heap_find.cpp"
    shutil.copy(strSrc, strHeapDir)
    strSrc = strRoot + "/examples/darwin/heap_find/heap/Makefile"
    shutil.copy(strSrc, strHeapDir)

    return (bOk, strMsg)
Example #17
0
def macosx_copy_file_for_heap( vDictArgs, vstrFrameworkPythonDir ):
    dbg = utilsDebug.CDebugFnVerbose( "Python script macosx_copy_file_for_heap()" );
    bOk = True;
    strMsg = "";

    eOSType = utilsOsType.determine_os_type();
    if eOSType != utilsOsType.EnumOsType.Darwin:
        return (bOk, strMsg);

    strHeapDir = os.path.join(vstrFrameworkPythonDir, "macosx", "heap");
    strHeapDir = os.path.normcase( strHeapDir );
    if (os.path.exists( strHeapDir ) and os.path.isdir( strHeapDir )):
        return (bOk, strMsg);

    os.makedirs( strHeapDir );

    strRoot = os.path.normpath(vDictArgs[ "--srcRoot" ]);
    strSrc = os.path.join(strRoot, "examples", "darwin", "heap_find", "heap", "heap_find.cpp");
    shutil.copy( strSrc, strHeapDir );
    strSrc = os.path.join(strRoot, "examples", "darwin", "heap_find", "heap", "Makefile");
    shutil.copy( strSrc, strHeapDir );

    return (bOk, strMsg);
Example #18
0
def main( vDictArgs ):
	dbg = utilsDebug.CDebugFnVerbose( "Python script main()" );
	bOk = True;
	strMsg = "";
	strErrMsgProgFail = "";
	
	bDbg = vDictArgs.has_key( "-d" );
	
	eOSType = utilsOsType.determine_os_type();
	if bDbg:
		pyVersion = sys.version_info;
		print(strMsgOsVersion % utilsOsType.EnumOsType.name_of( eOSType ));
		print(strMsgPyVersion % (pyVersion[ 0 ], pyVersion[ 1 ]));
	
	bOk, strFrameworkPythonDir, strMsg = get_framework_python_dir( vDictArgs );

	if bOk:
		bOk, strCfgBldDir, strMsg = get_config_build_dir( vDictArgs, strFrameworkPythonDir );
	if bOk and bDbg:
		print strMsgPyFileLocatedHere % strFrameworkPythonDir;
		print strMsgConfigBuildDir % strCfgBldDir;
	
	if bOk:
		bOk, strMsg = find_or_create_python_dir( vDictArgs, strFrameworkPythonDir );
	
	if bOk:
		bOk, strMsg = create_symlinks( vDictArgs, strFrameworkPythonDir );
	
	if bOk:
		bOk, strMsg = copy_lldbpy_file_to_lldb_pkg_dir( vDictArgs,
														strFrameworkPythonDir,
														strCfgBldDir );
	strRoot = vDictArgs[ "--srcRoot" ];
	if bOk:
		# lldb
		listPkgFiles = [ strRoot + "/source/Interpreter/embedded_interpreter.py" ];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "", listPkgFiles );
	
	if bOk:
		# lldb/formatters/cpp
		listPkgFiles = [ strRoot + "/examples/synthetic/gnu_libstdcpp.py",
						 strRoot + "/examples/synthetic/libcxx.py" ];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "/formatters/cpp", listPkgFiles );
	
	if bOk:
		# Make an empty __init__.py in lldb/runtime as this is required for 
		# Python to recognize lldb.runtime as a valid package (and hence,
		# lldb.runtime.objc as a valid contained package)
		listPkgFiles = [];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "/runtime", listPkgFiles );
	
	if bOk:
		# lldb/formatters
		# Having these files copied here ensure that lldb/formatters is a 
		# valid package itself
		listPkgFiles = [ strRoot + "/examples/summaries/cocoa/cache.py", 
						 strRoot + "/examples/summaries/cocoa/metrics.py",
						 strRoot + "/examples/summaries/cocoa/attrib_fromdict.py",
						 strRoot + "/examples/summaries/cocoa/Logger.py" ];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "/formatters", listPkgFiles );
	
	if bOk:
		# lldb/utils
		listPkgFiles = [ strRoot + "/examples/python/symbolication.py" ];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "/utils", listPkgFiles );
	
	if bOk and (eOSType == utilsOsType.EnumOsType.Darwin):
		# lldb/macosx
		listPkgFiles = [ strRoot + "/examples/python/crashlog.py",
						 strRoot + "/examples/darwin/heap_find/heap.py" ];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "/macosx", listPkgFiles );
	
	if bOk and (eOSType == utilsOsType.EnumOsType.Darwin):
		# lldb/diagnose
		listPkgFiles = [ strRoot + "/examples/python/diagnose_unwind.py",
						 strRoot + "/examples/python/diagnose_nsstring.py" ];
		bOk, strMsg = create_py_pkg( vDictArgs, strFrameworkPythonDir, "/diagnose", listPkgFiles );
	
	if bOk:
		bOk, strMsg = macosx_copy_file_for_heap( vDictArgs, strFrameworkPythonDir );
	
	if bOk:
		return (0, strMsg );
	else:
		strErrMsgProgFail += strMsg;
		return (-100, strErrMsgProgFail );
Example #19
0
def main(vDictArgs):
    dbg = utilsDebug.CDebugFnVerbose("Python script main()")
    bOk = True
    strMsg = ""
    strErrMsgProgFail = ""

    bDbg = "-d" in vDictArgs

    eOSType = utilsOsType.determine_os_type()
    if bDbg:
        pyVersion = sys.version_info
        print((strMsgOsVersion % utilsOsType.EnumOsType.name_of(eOSType)))
        print((strMsgPyVersion % (pyVersion[0], pyVersion[1])))

    bOk, strFrameworkPythonDir, strMsg = get_framework_python_dir(vDictArgs)

    if bOk:
        bOk, strCfgBldDir, strMsg = get_config_build_dir(
            vDictArgs, strFrameworkPythonDir)
    if bOk and bDbg:
        print((strMsgPyFileLocatedHere % strFrameworkPythonDir))
        print((strMsgConfigBuildDir % strCfgBldDir))

    if bOk:
        bOk, strLldbLibDir, strMsg = get_liblldb_dir(vDictArgs)

    if bOk:
        bOk, strMsg = find_or_create_python_dir(
            vDictArgs, strFrameworkPythonDir)

    if bOk:
        bOk, strMsg = create_symlinks(
            vDictArgs, strFrameworkPythonDir, strLldbLibDir)

    if bOk:
        bOk, strMsg = copy_six(vDictArgs, strFrameworkPythonDir)

    if bOk:
        bOk, strMsg = copy_lldbpy_file_to_lldb_pkg_dir(vDictArgs,
                                                       strFrameworkPythonDir,
                                                       strCfgBldDir)
    strRoot = os.path.normpath(vDictArgs["--srcRoot"])
    if bOk:
        # lldb
        listPkgFiles = [
            os.path.join(
                strRoot,
                "source",
                "Interpreter",
                "embedded_interpreter.py")]
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "", listPkgFiles)

    if bOk:
        # lldb/formatters/cpp
        listPkgFiles = [
            os.path.join(
                strRoot,
                "examples",
                "synthetic",
                "gnu_libstdcpp.py"),
            os.path.join(
                strRoot,
                "examples",
                "synthetic",
                "libcxx.py")]
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "/formatters/cpp", listPkgFiles)

    if bOk:
        # Make an empty __init__.py in lldb/runtime as this is required for
        # Python to recognize lldb.runtime as a valid package (and hence,
        # lldb.runtime.objc as a valid contained package)
        listPkgFiles = []
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "/runtime", listPkgFiles)

    if bOk:
        # lldb/formatters
        # Having these files copied here ensure that lldb/formatters is a
        # valid package itself
        listPkgFiles = [
            os.path.join(
                strRoot, "examples", "summaries", "cocoa", "cache.py"), os.path.join(
                strRoot, "examples", "summaries", "synth.py"), os.path.join(
                strRoot, "examples", "summaries", "cocoa", "metrics.py"), os.path.join(
                    strRoot, "examples", "summaries", "cocoa", "attrib_fromdict.py"), os.path.join(
                        strRoot, "examples", "summaries", "cocoa", "Logger.py")]
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "/formatters", listPkgFiles)

    if bOk:
        # lldb/utils
        listPkgFiles = [
            os.path.join(
                strRoot,
                "examples",
                "python",
                "symbolication.py")]
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "/utils", listPkgFiles)

    if bOk and (eOSType == utilsOsType.EnumOsType.Darwin):
        # lldb/macosx
        listPkgFiles = [
            os.path.join(
                strRoot,
                "examples",
                "python",
                "crashlog.py"),
            os.path.join(
                strRoot,
                "examples",
                "darwin",
                "heap_find",
                "heap.py")]
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "/macosx", listPkgFiles)

    if bOk and (eOSType == utilsOsType.EnumOsType.Darwin):
        # lldb/diagnose
        listPkgFiles = [
            os.path.join(
                strRoot,
                "examples",
                "python",
                "diagnose_unwind.py"),
            os.path.join(
                strRoot,
                "examples",
                "python",
                "diagnose_nsstring.py")]
        bOk, strMsg = create_py_pkg(
            vDictArgs, strFrameworkPythonDir, "/diagnose", listPkgFiles)

    if bOk:
        bOk, strMsg = macosx_copy_file_for_heap(
            vDictArgs, strFrameworkPythonDir)

    if bOk:
        return (0, strMsg)
    else:
        strErrMsgProgFail += strMsg
        return (-100, strErrMsgProgFail)