summaryrefslogtreecommitdiff
path: root/lldb/scripts/Python/edit-swig-python-wrapper-file.py
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-04-18 21:39:23 +0000
committerBill Wendling <isanbard@gmail.com>2012-04-18 21:39:23 +0000
commit392e4fbdd9b152efff4c051286f6b2c21270c902 (patch)
tree4ac339be2c4c7c596f068b59d5e512b157c7b433 /lldb/scripts/Python/edit-swig-python-wrapper-file.py
parenteb1c2bdc1f55fbc5d1e7bb86e9f0e038b0f5adb7 (diff)
Creating release_31 branchllvmorg-3.1.0-rc1
llvm-svn: 155059 llvm-svn: 155053 llvm-svn: 155051
Diffstat (limited to 'lldb/scripts/Python/edit-swig-python-wrapper-file.py')
-rw-r--r--lldb/scripts/Python/edit-swig-python-wrapper-file.py53
1 files changed, 0 insertions, 53 deletions
diff --git a/lldb/scripts/Python/edit-swig-python-wrapper-file.py b/lldb/scripts/Python/edit-swig-python-wrapper-file.py
deleted file mode 100644
index d64c0b408164..000000000000
--- a/lldb/scripts/Python/edit-swig-python-wrapper-file.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# edit-swig-python-wrapper-file.py
-#
-# This script performs some post-processing editing on the C++ file that
-# SWIG generates for python, after running on 'lldb.swig'. In
-# particular, on Apple systems we want to include the Python.h file that
-# is used in the /System/Library/Frameworks/Python.framework, but on other
-# systems we want to include plain <Python.h>. So we need to replace:
-#
-# #include <Python.h>
-#
-# with:
-#
-# #if defined (__APPLE__)
-# #include <Python/Python.h>
-# #else
-# #include <Python.h>
-# #endif
-#
-# That's what this python script does.
-#
-
-import os, sys
-
-include_python = '#include <Python.h>'
-include_python_ifdef = '''#if defined (__APPLE__)
-#include <Python/Python.h>
-#else
-#include <Python.h>
-#endif
-'''
-
-if len (sys.argv) > 1:
- input_dir_name = sys.argv[1]
- full_input_name = input_dir_name + "/LLDBWrapPython.cpp"
-else:
- input_dir_name = os.environ["SRCROOT"]
- full_input_name = input_dir_name + "/source/LLDBWrapPython.cpp"
-full_output_name = full_input_name + ".edited"
-
-with open(full_input_name, 'r') as f_in:
- with open(full_output_name, 'w') as f_out:
- include_python_found = False
- for line in f_in:
- if not include_python_found:
- if line.startswith(include_python):
- # Write out the modified lines.
- f_out.write(include_python_ifdef)
- include_python_found = True
- continue
-
- # Otherwise, copy the line verbatim to the output file.
- f_out.write(line)