[Lldb-commits] [lldb] r252026 - Python 3 - Don't add the _d suffix to the symlink on Windows.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 3 17:03:57 PST 2015


Author: zturner
Date: Tue Nov  3 19:03:57 2015
New Revision: 252026

URL: http://llvm.org/viewvc/llvm-project?rev=252026&view=rev
Log:
Python 3 - Don't add the _d suffix to the symlink on Windows.

In Python 2, a debug extension module required an _d suffix, so
for example the extension module `_lldb` would be backed by the file
`_lldb_d.pyd` if built in debug mode, and `_lldb.pyd` if built in
release mode.  In Python 2, although undocumented, this seems to
no longer be the case, and even for a debug extension module, the
interpreter will only look for the `_lldb.pyd` name.

Added:
    lldb/trunk/scripts/use_lldb_suite.py
Modified:
    lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
    lldb/trunk/scripts/buildSwigWrapperClasses.py
    lldb/trunk/scripts/finishSwigWrapperClasses.py

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=252026&r1=252025&r2=252026&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Tue Nov  3 19:03:57 2015
@@ -350,8 +350,10 @@ def make_symlink_liblldb( vDictArgs, vst
     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():
+        # "foo_d.pyd".  This only applies for Python 2, however.  Python 3 does
+        # not use the _d suffix for extension modules.
+        import six
+        if is_debug_interpreter() and six.PY2:
             strTarget += "_d";
         strTarget += ".pyd";
     else:

Modified: lldb/trunk/scripts/buildSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/buildSwigWrapperClasses.py?rev=252026&r1=252025&r2=252026&view=diff
==============================================================================
--- lldb/trunk/scripts/buildSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/buildSwigWrapperClasses.py Tue Nov  3 19:03:57 2015
@@ -31,6 +31,8 @@ import os       # Provide directory and
 # Third party modules:
 
 # In-house modules:
+import use_lldb_suite   # Modify sys.path so we can use shared / third-party libraries
+
 import utilsArgsParse   # Parse and validate this script's input arguments
 import utilsOsType      # Determine the OS type this script is running on
 import utilsDebug       # Debug Python scripts

Modified: lldb/trunk/scripts/finishSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finishSwigWrapperClasses.py?rev=252026&r1=252025&r2=252026&view=diff
==============================================================================
--- lldb/trunk/scripts/finishSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/finishSwigWrapperClasses.py Tue Nov  3 19:03:57 2015
@@ -29,6 +29,8 @@ import os       # Provide directory and
 # Third party modules:
 
 # In-house modules:
+import use_lldb_suite   # Modify sys.path so we can use shared / third-party libraries
+
 import utilsArgsParse   # Parse and validate this script's input arguments
 import utilsOsType      # Determine the OS type this script is running on
 import utilsDebug       # Debug Python scripts

Added: lldb/trunk/scripts/use_lldb_suite.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/use_lldb_suite.py?rev=252026&view=auto
==============================================================================
--- lldb/trunk/scripts/use_lldb_suite.py (added)
+++ lldb/trunk/scripts/use_lldb_suite.py Tue Nov  3 19:03:57 2015
@@ -0,0 +1,22 @@
+import inspect
+import os
+import sys
+
+def find_lldb_root():
+    lldb_root = os.path.dirname(inspect.getfile(inspect.currentframe()))
+    while True:
+        lldb_root = os.path.dirname(lldb_root)
+        if lldb_root is None:
+            return None
+
+        test_path = os.path.join(lldb_root, "lldb.root")
+        if os.path.isfile(test_path):
+            return lldb_root
+    return None
+
+lldb_root = find_lldb_root()
+if lldb_root is not None:
+    import imp
+    module = imp.find_module("use_lldb_suite_root", [lldb_root])
+    if module is not None:
+        imp.load_module("use_lldb_suite_root", *module)




More information about the lldb-commits mailing list