mgorny created this revision. mgorny added reviewers: jbcoe, arphaman, frutiger.
Support a new CLANG_LIBRARY_PATH environment variable within the Python bindings. This variable can be used to force the bindings to load libclang.* from a specific directory without having to explicitly read the path in the code using the library. I plan to use this when integrating Python binding tests with the CMake build system. Currently, those tests load libclang.so from default search paths, so I would have to rely on platform-specific mechanics such as LD_LIBRARY_PATH. Instead of copying the whole logic necessary to handle platform differences into yet another place, it's easier to just add a dedicated variable for this purpose. Repository: rC Clang https://reviews.llvm.org/D52806 Files: bindings/python/clang/cindex.py Index: bindings/python/clang/cindex.py =================================================================== --- bindings/python/clang/cindex.py +++ bindings/python/clang/cindex.py @@ -67,6 +67,7 @@ import clang.enumerations +import os import sys if sys.version_info[0] == 3: # Python 3 strings are unicode, translate them to/from utf8 for C-interop. @@ -4148,6 +4149,8 @@ if Config.library_path: file = Config.library_path + '/' + file + elif 'CLANG_LIBRARY_PATH' in os.environ: + file = os.environ['CLANG_LIBRARY_PATH'] + '/' + file return file
Index: bindings/python/clang/cindex.py =================================================================== --- bindings/python/clang/cindex.py +++ bindings/python/clang/cindex.py @@ -67,6 +67,7 @@ import clang.enumerations +import os import sys if sys.version_info[0] == 3: # Python 3 strings are unicode, translate them to/from utf8 for C-interop. @@ -4148,6 +4149,8 @@ if Config.library_path: file = Config.library_path + '/' + file + elif 'CLANG_LIBRARY_PATH' in os.environ: + file = os.environ['CLANG_LIBRARY_PATH'] + '/' + file return file
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits