diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 177c93d..ffd536e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,35 +35,30 @@ jobs: - name: Test package run: python -m pytest --forked -# Commented for now -- msys2 Clang (v15) and the clang Python package (v14) are incompatible -# -# checks_windows: -# strategy: -# fail-fast: false -# matrix: -# python-version: -# - "3.8" -# - "3.9" -# runs-on: -# - windows-latest -# runs-on: ${{ matrix.runs-on }} -# name: Test • 🐍 ${{ matrix.python-version }} • ${{matrix.runs-on}} -# steps: -# - uses: actions/checkout@v3 -# - uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Install package -# run: python -m pip install .[test] -# -# - name: Install clang -# run: C:\msys64\usr\bin\pacman.exe -S clang64/mingw-w64-clang-x86_64-clang --noconfirm -# -# - name: Test package -# env: -# LIBCLANG_PATH: C:\msys64\clang64\bin\libclang.dll -# run: python -m pytest -n2 + checks_windows: + strategy: + fail-fast: false + matrix: + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + runs-on: + - windows-latest + runs-on: ${{ matrix.runs-on }} + name: Test • 🐍 ${{ matrix.python-version }} • ${{matrix.runs-on}} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package + run: python -m pip install .[test] + + - name: Test package + run: python -m pytest -n2 dist: runs-on: ubuntu-latest diff --git a/pybind11_mkdoc/mkdoc_lib.py b/pybind11_mkdoc/mkdoc_lib.py index 0d591d4..cbc21b2 100755 --- a/pybind11_mkdoc/mkdoc_lib.py +++ b/pybind11_mkdoc/mkdoc_lib.py @@ -270,7 +270,7 @@ def read_args(args): sdk_dir = dev_path + 'Platforms/MacOSX.platform/Developer/SDKs' libclang = lib_dir + 'libclang.dylib' - if os.path.exists(libclang): + if cindex.Config.library_path is None and os.path.exists(libclang): cindex.Config.set_library_path(os.path.dirname(libclang)) if os.path.exists(sdk_dir): @@ -285,7 +285,7 @@ def read_args(args): else: raise FileNotFoundError("Failed to find libclang.dll! " "Set the LIBCLANG_PATH environment variable to provide a path to it.") - else: + elif cindex.Config.library_path is None: library_file = ctypes.util.find_library('libclang.dll') if library_file is not None: cindex.Config.set_library_file(library_file) @@ -306,7 +306,7 @@ def folder_version(d): # Ability to override LLVM/libclang paths if 'LLVM_DIR_PATH' in os.environ: llvm_dir = os.environ['LLVM_DIR_PATH'] - elif llvm_dir is None: + elif llvm_dir is None and cindex.Config.library_path is None: raise FileNotFoundError( "Failed to find a LLVM installation providing the file " "/usr/lib{32,64}/llvm-{VER}/lib/libclang.so.1. Make sure that " @@ -319,12 +319,12 @@ def folder_version(d): "variables.") if 'LIBCLANG_PATH' in os.environ: - libclang_dir = os.environ['LIBCLANG_PATH'] - else: - libclang_dir = os.path.join(llvm_dir, 'lib', 'libclang.so.1') + cindex.Config.set_library_file(os.environ['LIBCLANG_PATH']) + elif cindex.Config.library_path is None: + cindex.Config.set_library_file(os.path.join(llvm_dir, 'lib', + 'libclang.so.1')) - cindex.Config.set_library_file(libclang_dir) - cpp_dirs = [ ] + cpp_dirs = [] if '-stdlib=libc++' not in args: cpp_dirs.append(max( @@ -335,11 +335,16 @@ def folder_version(d): glob('/usr/include/%s-linux-gnu/c++/*' % platform.machine() ), default=None, key=folder_version)) else: + if llvm_dir is None: + raise FileNotFoundError( + "-stdlib=libc++ has been specified, but no LLVM " + "installation have been found on the system.") + cpp_dirs.append(os.path.join(llvm_dir, 'include', 'c++', 'v1')) if 'CLANG_INCLUDE_DIR' in os.environ: cpp_dirs.append(os.environ['CLANG_INCLUDE_DIR']) - else: + elif llvm_dir is not None: cpp_dirs.append(max( glob(os.path.join(llvm_dir, 'lib', 'clang', '*', 'include') ), default=None, key=folder_version)) diff --git a/pyproject.toml b/pyproject.toml index 4139ffb..77d29e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ classifiers = [ "Operating System :: POSIX", "Operating System :: MacOS" ] -requires = ["clang"] +requires = ["libclang"] requires-python = ">=3.6" [tool.flit.scripts]