forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compute Python library suffix in CMakeLists.txt
Introduce LLDB_PY_LIB_SUFFIX and use it in various places in the build. This lets the x.py-based build work properly without having to set LLVM_LIBDIR_SUFFIX. See https://bugs.llvm.org/show_bug.cgi?id=18957 for some discussion.
- Loading branch information
Showing
5 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import distutils.sysconfig | ||
import os | ||
import platform | ||
import re | ||
import sys | ||
|
||
|
||
def get_python_libdir_suffix(): | ||
"""Returns the appropropriate python libdir suffix. | ||
@return the python libdir suffix, normally either "" or "64". | ||
""" | ||
if platform.system() != 'Linux': | ||
return "" | ||
|
||
# We currently have a bug in lldb -P that does not account for | ||
# architecture variants in python paths for | ||
# architecture-specific modules. Handle the lookup here. | ||
# When that bug is fixed, we should just ask lldb for the | ||
# right answer always. | ||
arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False) | ||
split_libdir = arch_specific_libdir.split(os.sep) | ||
lib_re = re.compile(r"^lib.+$") | ||
|
||
for i in range(len(split_libdir)): | ||
match = lib_re.match(split_libdir[i]) | ||
if match is not None: | ||
return split_libdir[i][3:] | ||
return "" | ||
|
||
if __name__ == '__main__': | ||
sys.stdout.write(get_python_libdir_suffix()) | ||
sys.exit(0) |