--- ctypeslib/__init__.py.orig	2023-04-24 19:30:48
+++ ctypeslib/__init__.py	2023-05-26 16:13:39
@@ -32,33 +32,6 @@
     __version__ = __dist.version
 
 
-def __find_clang_libraries():
-    """ configure python-clang to use the local clang library """
-    _libs = []
-    # try for a file with a version match with the clang python package version
-    version_major = __clang_py_version__.split('.')[0]
-    # try default system name
-    v_list = [f"clang-{__clang_py_version__}", f"clang-{version_major}", "libclang", "clang"]
-    # tries clang version 16 to 7
-    v_list += [f"clang-{_}" for _ in range(16, 6, -1)]
-    # with the dotted form of clang 6.0 to 4.0
-    v_list += [f"clang-{_:.1f}" for _ in range(6, 3, -1)]
-    # clang 3 supported versions
-    v_list += ["clang-3.9", "clang-3.8", "clang-3.7"]
-    for _version in v_list:
-        _filename = find_library(_version)
-        if _filename:
-            _libs.append(_filename)
-    # On darwin, also consider either Xcode or CommandLineTools.
-    if os.name == "posix" and sys.platform == "darwin":
-        for _ in ['/Library/Developer/CommandLineTools/usr/lib/libclang.dylib',
-                  '/Applications/Xcode.app/Contents/Frameworks/libclang.dylib',
-                  ]:
-            if os.path.exists(_):
-                _libs.insert(0, _)
-    return _libs
-
-
 def clang_version():
     """Pull the clang C library version from the API"""
     # avoid loading the cindex API (cindex.conf.lib) to avoid version conflicts
@@ -79,33 +52,9 @@
 
 
 def __configure_clang_cindex():
-    """
-    First we attempt to configure clang with the library path set in environment variable
-    Second we attempt to configure clang with a clang library version similar to the clang python package version
-    Third we attempt to configure clang with any clang library we can find
-    """
-    # first, use environment variables set by user
-    __libs = []
-    __lib_path = os.environ.get('CLANG_LIBRARY_PATH')
-    if __lib_path is not None:
-        if not os.path.exists(__lib_path):
-            warnings.warn("Filepath in CLANG_LIBRARY_PATH does not exist", RuntimeWarning)
-        else:
-            __libs.append(__lib_path)
-    __libs.extend(__find_clang_libraries())
-    for __library_path in __libs:
-        try:
-            if os.path.isdir(__library_path):
-                cindex.Config.set_library_path(__library_path)
-            else:
-                cindex.Config.set_library_file(__library_path)
-            # force-check that clang is configured properly
-            clang_version()
-        except cindex.LibclangError:
-            warnings.warn(f"Could not configure clang with library_path={__library_path}", RuntimeWarning)
-            continue
-        return __library_path
-    return None
+    # The (MacPorts) installed clang module already knows (and depends upon)
+    # the appropriate libclang; don't go searching for something else.
+    return cindex.Config().get_filename()
 
 
 # check which clang python module is available
