[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

Ryan Mast via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 5 18:26:32 PST 2025


================
@@ -0,0 +1,3 @@
+node: $Format:%H$
+node-date: $Format:%cI$
+describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
----------------
nightlark wrote:

The more open ended match is the standard one that setuptools_scm documents, but we can make it more flexible.

I tried the pip install from a URL, and might have come across some behavior in setuptools_scm that could perhaps be considered bugs. It looks like setuptools_scm doesn't correctly remove subfolders when trying to determine the path to git repository root, so `root = "../../.."` is needed to make it work for installing from a git clone/checkout. It actually looks like the `setuptools_scm.root` is ignored when installing from an https source archive or directory that isn't a git repo -- I had to move .git_archival.txt to the clang bindings subfolder to make it find that file.

`pip install git+https://github.com/nightlark/llvm-project@add-python-packaging#subdirectory=clang/bindings/python`
* has git version info, works as expected to install with version information when `root = "../../.."` option is set

`pip install https://github.com/nightlark/llvm-project/archive/refs/heads/add-python-packaging.zip#subdirectory=clang/bindings/python`
* no git version info, finds version info from .git_archival.txt when the file is located in `clang/bindings/python`
* setting or not setting `setuptools_scm.root` has no effect on where it searches for the .git_archival.txt file



https://github.com/llvm/llvm-project/pull/125806


More information about the cfe-commits mailing list