[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)
Ryan Mast via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 7 13:54:30 PST 2025
================
@@ -0,0 +1,36 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm==8.1.0"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = {text = "Apache-2.0 WITH LLVM-exception"}
+authors = [
+ { name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+ "Intended Audience :: Developers",
+ "Development Status :: 5 - Production/Stable",
+ "Topic :: Software Development :: Compilers",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://clang.llvm.org/"
+Download = "https://llvm.org/releases/download.html"
+Discussions = "https://discourse.llvm.org/"
+"Issue Tracker" = "https://github.com/llvm/llvm-project/issues"
+"Source Code" = "https://github.com/llvm/llvm-project/tree/main/clang/bindings/python"
+
+[tool.setuptools_scm]
+root = "../../.."
+version_file = "clang/_version.py"
+version_scheme = "no-guess-dev"
+# Regex version capture group gets x.y.z with optional -rcN, -aN, -bN suffixes; -init is just consumed
+tag_regex = "^llvmorg-(?P<version>\\d+(?:\\.\\d+)*(?:-(?:rc|a|b)\\d+)?)(?:.*)$"
----------------
nightlark wrote:
I updated it to only match an `-rcN` suffix as part of the captured version. I had to leave the first `\\d+` to match the first number in the version component (the repeating portion requires a `.` to come before the number).
Since the version tags seem to typically only be on commits in release branches and the main branch only has `llvmorg-N-init` tags, I left the `*` so it can pick up the major version number from the `llvmorg-N-init` tag, and the `(?:.*)` at the end to ignore the trailing `-ini`. This makes so if someone installs from the main branch it will at least pick up a major version number rather than using the fallback_version.
The typical version number when installing from a random commit in the main branch will be something like `21.post.devN` -- so developers installing from main will at least have some indication of the major version of the bindings they've installed.
https://github.com/llvm/llvm-project/pull/125806
More information about the llvm-commits
mailing list