forked from OSchip/llvm-project
[python] [tests] Support overriding library path via environment
Support a new CLANG_LIBRARY_PATH environment variable for the Python binding tests. This variable can be used to force the bindings to load libclang.* from a specific directory. 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. Differential Revision: https://reviews.llvm.org/D52806 llvm-svn: 344240
This commit is contained in:
parent
8066198442
commit
c37d16140a
|
@ -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
|
||||
...
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import AccessSpecifier
|
||||
from clang.cindex import Cursor
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import CompilationDatabase
|
||||
from clang.cindex import CompilationDatabaseError
|
||||
from clang.cindex import CompileCommands
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import TranslationUnit
|
||||
|
||||
import unittest
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import TranslationUnit
|
||||
from tests.cindex.util import get_cursor
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
import ctypes
|
||||
import gc
|
||||
import unittest
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import CursorKind
|
||||
|
||||
import unittest
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import *
|
||||
from .util import get_tu
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
import clang.cindex
|
||||
from clang.cindex import ExceptionSpecificationKind
|
||||
from .util import get_tu
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import Index, File
|
||||
|
||||
import unittest
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import *
|
||||
import os
|
||||
import unittest
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import LinkageKind
|
||||
from clang.cindex import Cursor
|
||||
from clang.cindex import TranslationUnit
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import Cursor
|
||||
from clang.cindex import File
|
||||
from clang.cindex import SourceLocation
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import TLSKind
|
||||
from clang.cindex import Cursor
|
||||
from clang.cindex import TranslationUnit
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import TokenKind
|
||||
|
||||
import unittest
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from clang.cindex import CursorKind
|
||||
from clang.cindex import Index
|
||||
from clang.cindex import SourceLocation
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
from contextlib import contextmanager
|
||||
import gc
|
||||
import os
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import os
|
||||
from clang.cindex import Config
|
||||
if 'CLANG_LIBRARY_PATH' in os.environ:
|
||||
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
|
||||
|
||||
import gc
|
||||
import unittest
|
||||
|
||||
|
|
Loading…
Reference in New Issue