summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/finish-swig-Python-LLDB.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python/finish-swig-Python-LLDB.sh')
-rwxr-xr-xlldb/scripts/Python/finish-swig-Python-LLDB.sh509
1 files changed, 100 insertions, 409 deletions
diff --git a/lldb/scripts/Python/finish-swig-Python-LLDB.sh b/lldb/scripts/Python/finish-swig-Python-LLDB.sh
index 13194f4567a..739d41e8251 100755
--- a/lldb/scripts/Python/finish-swig-Python-LLDB.sh
+++ b/lldb/scripts/Python/finish-swig-Python-LLDB.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/sh -x
# finish-swig-Python.sh
#
@@ -75,13 +75,13 @@ then
# Make the Python directory in the framework if it doesn't already exist
- framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python"
+ framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python/lldb"
else
# We are on a non-Darwin system, 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.
- framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}"
+ framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}/lldb"
fi
#
@@ -94,25 +94,30 @@ then
echo "Python files will be put in ${framework_python_dir}"
fi
-if [ ! -d "${framework_python_dir}" ]
-then
- if [ $Debug == 1 ]
+python_dirs="${framework_python_dir}"
+
+for python_dir in $python_dirs
+do
+ if [ ! -d "${python_dir}" ]
then
- echo "Making directory ${framework_python_dir}"
+ if [ $Debug == 1 ]
+ then
+ echo "Making directory ${python_dir}"
+ fi
+ mkdir -p "${python_dir}"
+ else
+ if [ $Debug == 1 ]
+ then
+ echo "${python_dir} already exists."
+ fi
fi
- mkdir -p "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
+
+ if [ ! -d "${python_dir}" ]
then
- echo "${framework_python_dir} already exists."
+ echo "Error: Unable to find or create ${python_dir}" >&2
+ exit 1
fi
-fi
-
-if [ ! -d "${framework_python_dir}" ]
-then
- echo "Error: Unable to find or create ${framework_python_dir}" >&2
- exit 1
-fi
+done
# Make the symlink that the script bridge for Python will need in the
# Python framework directory
@@ -126,10 +131,10 @@ then
if [ ${OS_NAME} == "Darwin" ]
then
cd "${framework_python_dir}"
- ln -s "../../LLDB" _lldb.so
+ ln -s "../../../LLDB" _lldb.so
else
cd "${TARGET_DIR}"
- ln -s "./LLDB" _lldb.so
+ ln -s "../LLDB" _lldb.so
fi
else
if [ $Debug == 1 ]
@@ -138,419 +143,105 @@ else
fi
fi
-# Copy the python module (lldb.py) that was generated by SWIG
-# over to the framework Python directory
-if [ -f "${CONFIG_BUILD_DIR}/lldb.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying lldb.py to ${framework_python_dir}"
- fi
- cp "${CONFIG_BUILD_DIR}/lldb.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${CONFIG_BUILD_DIR}/lldb.py"
- fi
-fi
-# Copy the embedded interpreter script over to the framework Python directory
-if [ -f "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying embedded_interpreter.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/source/Interpreter/embedded_interpreter.py"
- fi
-fi
+function create_python_package {
+ package_dir="${framework_python_dir}$1"
+ package_files="$2"
-# Copy the C++ STL formatters over to the framework Python directory
-if [ -f "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" ]
-then
- if [ $Debug == 1 ]
+ if [ ! -d "${package_dir}" ]
then
- echo "Copying gnu_libstdcpp.py to ${framework_python_dir}"
+ mkdir -p "${package_dir}"
fi
- cp "${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py"
- fi
-fi
-if [ -f "${SRC_ROOT}/examples/synthetic/libcxx.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying libcxx.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/synthetic/libcxx.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/synthetic/libcxx.py"
- fi
-fi
+ for package_file in $package_files
+ do
+ if [ -f "${package_file}" ]
+ then
+ cp "${package_file}" "${package_dir}"
+ package_file_basename=$(basename "${package_file}")
+ fi
+ done
-# Copy the ObjC formatters over to the framework Python directory
-if [ -f "${SRC_ROOT}/examples/summaries/objc.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying objc.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/objc.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/objc.py"
- fi
-fi
-# Copy the Cocoa formatters over to the framework Python directory
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFArray.py" ]
-then
- if [ $Debug == 1 ]
+ # Create a packate init file if there wasn't one
+ package_init_file="${package_dir}/__init__.py"
+ if [ ! -f "${package_init_file}" ]
then
- echo "Copying CFArray.py to ${framework_python_dir}"
+ echo -n "__all__ = [" > "${package_init_file}"
+ python_module_separator=""
+ for package_file in $package_files
+ do
+ if [ -f "${package_file}" ]
+ then
+ package_file_basename=$(basename "${package_file}")
+ echo -n "${python_module_separator}\"${package_file_basename%.*}\"" >> "${package_init_file}"
+ python_module_separator=", "
+ fi
+ done
+ echo "]" >> "${package_init_file}"
fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/CFArray.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFArray.py"
- fi
-fi
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying CFDictionary.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py"
- fi
-fi
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFString.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying CFString.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/CFString.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFString.py"
- fi
-fi
+}
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSData.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSData.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSData.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSData.py"
- fi
-fi
+# Copy the lldb.py file into the lldb package directory and rename to __init_.py
+cp "${CONFIG_BUILD_DIR}/lldb.py" "${framework_python_dir}/__init__.py"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSMachPort.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py"
- fi
-fi
+# lldb
+package_files="${SRC_ROOT}/source/Interpreter/embedded_interpreter.py"
+create_python_package "" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSSet.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSSet.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSSet.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSSet.py"
- fi
-fi
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSNotification.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py"
- fi
-fi
+# lldb/formatters/cpp
+package_files="${SRC_ROOT}/examples/synthetic/gnu_libstdcpp.py
+${SRC_ROOT}/examples/synthetic/libcxx.py"
+create_python_package "/formatters/cpp" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSException.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSException.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSException.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSException.py"
- fi
-fi
+# lldb/formatters/objc
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFBag.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying CFBag.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/CFBag.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFBag.py"
- fi
-fi
+package_files="${SRC_ROOT}/examples/summaries/cocoa/Selector.py
+${SRC_ROOT}/examples/summaries/objc.py
+${SRC_ROOT}/examples/summaries/cocoa/Class.py
+${SRC_ROOT}/examples/summaries/cocoa/CFArray.py
+${SRC_ROOT}/examples/summaries/cocoa/CFBag.py
+${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py
+${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py
+${SRC_ROOT}/examples/summaries/cocoa/CFDictionary.py
+${SRC_ROOT}/examples/summaries/cocoa/CFString.py
+${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py
+${SRC_ROOT}/examples/summaries/cocoa/NSData.py
+${SRC_ROOT}/examples/summaries/cocoa/NSDate.py
+${SRC_ROOT}/examples/summaries/cocoa/NSException.py
+${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py
+${SRC_ROOT}/examples/summaries/cocoa/NSMachPort.py
+${SRC_ROOT}/examples/summaries/cocoa/NSNotification.py
+${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py
+${SRC_ROOT}/examples/summaries/cocoa/NSSet.py
+${SRC_ROOT}/examples/summaries/cocoa/NSURL.py"
+create_python_package "/formatters/objc" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying CFBinaryHeap.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFBinaryHeap.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSURL.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSURL.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSURL.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSURL.py"
- fi
-fi
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSBundle.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSBundle.py"
- fi
-fi
+# lldb/runtime/objc
+package_files="${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py"
+create_python_package "/runtime/objc" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSNumber.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSNumber.py"
- fi
-fi
+# lldb/formatters
+package_files="${SRC_ROOT}/examples/summaries/cocoa/cache.py
+${SRC_ROOT}/examples/summaries/cocoa/metrics.py
+${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py
+${SRC_ROOT}/examples/summaries/cocoa/Logger.py"
+create_python_package "/formatters" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSDate.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSDate.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSDate.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSDate.py"
- fi
-fi
+# lldb/utils
+package_files="${SRC_ROOT}/examples/python/symbolication.py"
+create_python_package "/utils" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying NSIndexSet.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/NSIndexSet.py"
- fi
-fi
+# lldb/macosx
+package_files="${SRC_ROOT}/examples/python/crashlog.py
+${SRC_ROOT}/examples/darwin/heap_find/heap.py"
+create_python_package "/macosx" "${package_files}"
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying CFBitVector.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/CFBitVector.py"
- fi
-fi
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Selector.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying Selector.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/Selector.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Selector.py"
- fi
fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Class.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying Class.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/Class.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Class.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/cache.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying cache.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/cache.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/cache.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/metrics.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying metrics.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/metrics.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/metrics.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying attrib_fromdict.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/attrib_fromdict.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/Logger.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying Logger.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/Logger.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/Logger.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/objc_lldb.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying objc_lldb.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/objc_lldb.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/objc_lldb.py"
- fi
-fi
-
-if [ -f "${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py" ]
-then
- if [ $Debug == 1 ]
- then
- echo "Copying objc_runtime.py to ${framework_python_dir}"
- fi
- cp "${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py" "${framework_python_dir}"
-else
- if [ $Debug == 1 ]
- then
- echo "Unable to find ${SRC_ROOT}/examples/summaries/cocoa/objc_runtime.py"
- fi
-fi
-
-fi
-
exit 0
OpenPOWER on IntegriCloud