sources.build_sdist() decides between PEP 517 and tarball based solely on req.url. When req.url is None (as it is for new-source git clones), the function falls to the tarball path. But a raw git checkout lacks proper sdist metadata, and packages using setuptools-scm will produce broken sdists with version 0.0.0.
Each resolver model in _resolver.py already declares a build_sdist field (BuildSDist.pep517 or BuildSDist.tarball) that is not yet consulted by the runtime.
Fix
prepare_source(): detect when the source is a directory:
if req.url or source_filename.is_dir():
source_root_dir = pathlib.Path(source_filename)
prepare_new_source(...)
build_sdist(): check pbi.source_resolver.build_sdist:
source = pbi.source_resolver
if req.url:
sdist_file = pep517_build_sdist(...)
elif source is not None and source.build_sdist == BuildSDist.pep517:
sdist_file = pep517_build_sdist(...)
else:
sdist_file = overrides.find_and_invoke("build_sdist", default_build_sdist, ...)
sources.build_sdist() decides between PEP 517 and tarball based solely on req.url. When req.url is None (as it is for new-source git clones), the function falls to the tarball path. But a raw git checkout lacks proper sdist metadata, and packages using setuptools-scm will produce broken sdists with version 0.0.0.
Each resolver model in _resolver.py already declares a build_sdist field (BuildSDist.pep517 or BuildSDist.tarball) that is not yet consulted by the runtime.
Fix
prepare_source(): detect when the source is a directory:
build_sdist(): check pbi.source_resolver.build_sdist: