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. llvm-svn: 252026
This commit is contained in:
parent
bbc5b46a10
commit
b20ef35645
|
@ -350,8 +350,10 @@ def make_symlink_liblldb( vDictArgs, vstrFrameworkPythonDir, vstrLiblldbFileName
|
||||||
if eOSType == utilsOsType.EnumOsType.Windows:
|
if eOSType == utilsOsType.EnumOsType.Windows:
|
||||||
# When importing an extension module using a debug version of python, you
|
# When importing an extension module using a debug version of python, you
|
||||||
# write, for example, "import foo", but the interpreter searches for
|
# write, for example, "import foo", but the interpreter searches for
|
||||||
# "foo_d.pyd"
|
# "foo_d.pyd". This only applies for Python 2, however. Python 3 does
|
||||||
if is_debug_interpreter():
|
# not use the _d suffix for extension modules.
|
||||||
|
import six
|
||||||
|
if is_debug_interpreter() and six.PY2:
|
||||||
strTarget += "_d";
|
strTarget += "_d";
|
||||||
strTarget += ".pyd";
|
strTarget += ".pyd";
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -31,6 +31,8 @@ import os # Provide directory and file handling
|
||||||
# Third party modules:
|
# Third party modules:
|
||||||
|
|
||||||
# In-house 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 utilsArgsParse # Parse and validate this script's input arguments
|
||||||
import utilsOsType # Determine the OS type this script is running on
|
import utilsOsType # Determine the OS type this script is running on
|
||||||
import utilsDebug # Debug Python scripts
|
import utilsDebug # Debug Python scripts
|
||||||
|
|
|
@ -29,6 +29,8 @@ import os # Provide directory and file handling
|
||||||
# Third party modules:
|
# Third party modules:
|
||||||
|
|
||||||
# In-house 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 utilsArgsParse # Parse and validate this script's input arguments
|
||||||
import utilsOsType # Determine the OS type this script is running on
|
import utilsOsType # Determine the OS type this script is running on
|
||||||
import utilsDebug # Debug Python scripts
|
import utilsDebug # Debug Python scripts
|
||||||
|
|
|
@ -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)
|
Loading…
Reference in New Issue