10 libclang = llvmPackages.libclang;
12 pyproject_toml = writeText "pyproject.toml" ''
14 requires = ["setuptools>=42", "wheel"]
15 build-backend = "setuptools.build_meta"
18 setup_cfg = writeText "setup.cfg" ''
21 version = ${libclang.version}
31 inherit (libclang) version src;
33 buildInputs = [ setuptools ];
36 # set source root to python bindings
37 if [ -e "$sourceRoot/clang/bindings/python" ]; then
38 # LLVM 13+ puts clang sources in subdirectory instead of plain tarball
39 sourceRoot="$sourceRoot/clang/bindings/python"
41 sourceRoot="$sourceRoot/bindings/python"
46 # link in our own build info to build as a python package
47 ln -s ${pyproject_toml} ./pyproject.toml
48 ln -s ${setup_cfg} ./setup.cfg
50 # set passed libclang for runtime
51 echo 'Config.set_library_path("${lib.getLib libclang}/lib")' >>./clang/cindex.py
54 meta = libclang.meta // {
55 description = "Python bindings for the C language family frontend for LLVM";