9 libclang = llvmPackages.libclang;
11 pyproject_toml = writeText "pyproject.toml" ''
13 requires = ["setuptools>=42", "wheel"]
14 build-backend = "setuptools.build_meta"
17 setup_cfg = writeText "setup.cfg" ''
20 version = ${libclang.version}
25 in buildPythonPackage {
29 inherit (libclang) version src;
31 buildInputs = [ setuptools ];
34 # set source root to python bindings
35 if [ -e "$sourceRoot/clang/bindings/python" ]; then
36 # LLVM 13+ puts clang sources in subdirectory instead of plain tarball
37 sourceRoot="$sourceRoot/clang/bindings/python"
39 sourceRoot="$sourceRoot/bindings/python"
44 # link in our own build info to build as a python package
45 ln -s ${pyproject_toml} ./pyproject.toml
46 ln -s ${setup_cfg} ./setup.cfg
48 # set passed libclang for runtime
49 echo 'Config.set_library_path("${lib.getLib libclang}/lib")' >>./clang/cindex.py
52 meta = libclang.meta // {
53 description = "Python bindings for the C language family frontend for LLVM";
54 maintainers = with lib.maintainers; [ lilyinstarlight ];