mgorny updated this revision to Diff 168042.
mgorny added a comment.

(also included README update)


https://reviews.llvm.org/D52806

Files:
  bindings/python/README.txt
  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/README.txt
===================================================================
--- bindings/python/README.txt
+++ bindings/python/README.txt
@@ -4,12 +4,12 @@
 
 This directory implements Python bindings for Clang.
 
-You may need to alter LD_LIBRARY_PATH so that the Clang library can be
+You may need to set CLANG_LIBRARY_PATH so that the Clang library can be
 found. The unit tests are designed to be run with any standard test
 runner. For example:
 --
 $ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/) \
-      LD_LIBRARY_PATH=$(llvm-config --libdir) \
+      CLANG_LIBRARY_PATH=$(llvm-config --libdir) \
   python -m unittest discover -v
 tests.cindex.test_index.test_create ... ok
 ...


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/README.txt
===================================================================
--- bindings/python/README.txt
+++ bindings/python/README.txt
@@ -4,12 +4,12 @@
 
 This directory implements Python bindings for Clang.
 
-You may need to alter LD_LIBRARY_PATH so that the Clang library can be
+You may need to set CLANG_LIBRARY_PATH so that the Clang library can be
 found. The unit tests are designed to be run with any standard test
 runner. For example:
 --
 $ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/) \
-      LD_LIBRARY_PATH=$(llvm-config --libdir) \
+      CLANG_LIBRARY_PATH=$(llvm-config --libdir) \
   python -m unittest discover -v
 tests.cindex.test_index.test_create ... ok
 ...
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to