diff --git a/lldb/scripts/Python/finishSwigPythonLLDB.py b/lldb/scripts/Python/finishSwigPythonLLDB.py --- a/lldb/scripts/Python/finishSwigPythonLLDB.py +++ b/lldb/scripts/Python/finishSwigPythonLLDB.py @@ -5,8 +5,6 @@ Overview: Python script(s) to post process SWIG Python C++ Script Bridge wrapper code on the Windows/LINUX/OSX platform. - The Python scripts are equivalent to the shell script (.sh) - files. For the Python script interpreter (external to liblldb) to be able to import and use the lldb module, there must be two files, lldb.py and _lldb.so, that it can find. lldb.py @@ -617,7 +615,8 @@ #++--------------------------------------------------------------------------- # Details: Determine where to put the files. Retrieve the directory path for -# Python's dist_packages/ site_package folder on a Windows platform. +# Python's dist_packages / site_package folder when build with LLVM +# build system. # Args: vDictArgs - (R) Program input parameters. # Returns: Bool - True = function success, False = failure. # Str - Python Framework directory path. @@ -626,13 +625,14 @@ #-- -def get_framework_python_dir_windows(vDictArgs): +def get_framework_python_dir_llvm(vDictArgs): dbg = utilsDebug.CDebugFnVerbose( - "Python script get_framework_python_dir_windows()") + "Python script get_framework_python_dir_llvm()") bOk = True strWkDir = "" strErrMsg = "" + dbg.dump_text("Built by LLVM") # We are being built by LLVM, so use the PYTHON_INSTALL_DIR argument, # and append the python version directory to the end of it. Depending # on the system other stuff may need to be put here as well. @@ -658,7 +658,7 @@ #++--------------------------------------------------------------------------- # Details: Retrieve the directory path for Python's dist_packages/ -# site_package folder on a UNIX style platform. +# site_package folder for xcode. # Args: vDictArgs - (R) Program input parameters. # Returns: Bool - True = function success, False = failure. # Str - Python Framework directory path. @@ -667,32 +667,27 @@ #-- -def get_framework_python_dir_other_platforms(vDictArgs): +def get_framework_python_dir_xcode(vDictArgs): dbg = utilsDebug.CDebugFnVerbose( - "Python script get_framework_python_dir_other_platform()") + "Python script get_framework_python_dir_xcode()") bOk = True strWkDir = "" strErrMsg = "" bDbg = "-d" in vDictArgs - bMakeFileCalled = "-m" in vDictArgs - if bMakeFileCalled: - dbg.dump_text("Built by LLVM") - return get_framework_python_dir_windows(vDictArgs) + dbg.dump_text("Built by XCode") + # We are being built by XCode, so all the lldb Python files can go + # into the LLDB.framework/Resources/Python subdirectory. + strWkDir = vDictArgs["--targetDir"] + strWkDir = os.path.join(strWkDir, "LLDB.framework") + if os.path.exists(strWkDir): + if bDbg: + print((strMsgFoundLldbFrameWkDir % strWkDir)) + strWkDir = os.path.join(strWkDir, "Resources", "Python", "lldb") + strWkDir = os.path.normcase(strWkDir) else: - dbg.dump_text("Built by XCode") - # We are being built by XCode, so all the lldb Python files can go - # into the LLDB.framework/Resources/Python subdirectory. - strWkDir = vDictArgs["--targetDir"] - strWkDir = os.path.join(strWkDir, "LLDB.framework") - if os.path.exists(strWkDir): - if bDbg: - print((strMsgFoundLldbFrameWkDir % strWkDir)) - strWkDir = os.path.join(strWkDir, "Resources", "Python", "lldb") - strWkDir = os.path.normcase(strWkDir) - else: - bOk = False - strErrMsg = strErrMsgFrameWkPyDirNotExist % strWkDir + bOk = False + strErrMsg = strErrMsgFrameWkPyDirNotExist % strWkDir return (bOk, strWkDir, strErrMsg) @@ -715,17 +710,11 @@ 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) + bMakeFileCalled = "-m" in vDictArgs + if bMakeFileCalled: + return get_framework_python_dir_llvm(vDictArgs) else: - bOk, strWkDir, strErrMsg = get_framework_python_dir_other_platforms( - vDictArgs) - - return (bOk, strWkDir, strErrMsg) + return get_framework_python_dir_xcode(vDictArgs) #++--------------------------------------------------------------------------- # Details: Retrieve the liblldb directory path, if it exists and is valid. diff --git a/lldb/scripts/finishSwigWrapperClasses.py b/lldb/scripts/finishSwigWrapperClasses.py --- a/lldb/scripts/finishSwigWrapperClasses.py +++ b/lldb/scripts/finishSwigWrapperClasses.py @@ -5,8 +5,6 @@ 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 @@ -293,11 +291,9 @@ # Iterate script directory find any script language directories for scriptLang in listDirs: - # __pycache__ is a magic directory in Python 3 that holds .pyc files - if scriptLang != "__pycache__" and scriptLang != "swig_bot_lib": - dbg.dump_text("Executing language script for \'%s\'" % scriptLang) - nResult, strStatusMsg = run_post_process( - scriptLang, strFinishFileName, vDictArgs) + dbg.dump_text("Executing language script for \'%s\'" % scriptLang) + nResult, strStatusMsg = run_post_process( + scriptLang, strFinishFileName, vDictArgs) if nResult < 0: break