Skip to content

Wire prepare_source and build_sdist for git-clone-based source resolvers #1205

Description

@smoparth

Context

PR #1202 wired source_resolver into the resolver and download pipelines. Git-clone-based resolvers (github-tag-git, gitlab-tag-git, pypi-git) now resolve and clone correctly, but the prepare_source and build_sdist steps don't yet handle the cloned directory.

prepare_source crashes on git-clone directories

sources.prepare_source() decides how to prepare source based on req.url:

if req.url:
    source_root_dir = pathlib.Path(source_filename)
    prepare_new_source(...)
else:
    prepare_source_details = overrides.find_and_invoke("prepare_source", default_prepare_source, ...)

When a package uses the new source config with a git-clone-based resolver, req.url is None, so it takes the else path. That calls default_prepare_source() -> unpack_source(), which tries to open source_filename as a .tar.gz or .zip. But source_filename is a directory (the cloned git repo). This crashes with:

ValueError: Do not know how to unpack source archive /path/to/mypackage-1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions