Skip to content

clang python bindings fail to build from 23.1.0-rc2 archive #212578

Description

@mgorny

In unpacked https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.0-rc2/llvm-project-23.1.0-rc2.src.tar.xz:

$ cd clang/bindings/python
$ uv build
Building source distribution...
Traceback (most recent call last):
  File "<string>", line 11, in <module>
    sdist_filename = backend.build_sdist(__import__("os").fsdecode(b"/var/tmp/portage/dev-python/clang-23.1.0_rc2/work/clang/bindings/python/dist"), {})
  File "/root/.cache/uv/builds-v0/.tmpMFyX6f/lib/python3.14/site-packages/hatchling/build.py", line 34, in build_sdist
    return os.path.basename(next(builder.build(directory=sdist_directory, versions=["standard"])))
                            ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmpMFyX6f/lib/python3.14/site-packages/hatchling/builders/plugin/interface.py", line 92, in build
    self.metadata.validate_fields()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/root/.cache/uv/builds-v0/.tmpMFyX6f/lib/python3.14/site-packages/hatchling/metadata/core.py", line 265, in validate_fields
    _ = self.version
        ^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmpMFyX6f/lib/python3.14/site-packages/hatchling/metadata/core.py", line 149, in version
    self._version = self._get_version()
                    ~~~~~~~~~~~~~~~~~^^
  File "/root/.cache/uv/builds-v0/.tmpMFyX6f/lib/python3.14/site-packages/hatchling/metadata/core.py", line 248, in _get_version
    version = self.hatch.version.cached
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.cache/uv/builds-v0/.tmpMFyX6f/lib/python3.14/site-packages/hatchling/metadata/core.py", line 1531, in cached
    raise type(e)(message) from None
ValueError: Error getting the version from source `vcs`: invalid literal for int() with base 10: '23.1.0'
error: Failed to build `/var/tmp/portage/dev-python/clang-23.1.0_rc2/work/clang/bindings/python`
  Caused by: The build backend returned an error
  Caused by: Call to `hatchling.build.build_sdist` failed (exit status: 1)

hint: Build failures usually indicate a problem with the package or the build environment

My educated guess is that the .git_archival.txt file is wrong somehow.

CC @nightlark

Metadata

Metadata

Assignees

No one assigned

    Labels

    build-problemclangClang issues not falling into any other category

    Type

    No type

    Projects

    Status
    Needs Fix

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions