- The build_sdist hook must be defined, but may not always work (e.g. it
may depend on a VCS)
I was going to object to this aspect, but I realised there's a clear
marker file that frontends can use to determine if they're working
with an already exported sdist tree: PKG-INFO
That means the invocation protocol for the additional hook can be:
- if PKG-INFO is present, then just copy the full contents of the
directory without invoking the backend's sdist export hook
- if PKG-INFO is *not* present, then invoke the backend's sdist export
hook to do a filtered export that at least omits any VCS bookkeeping
files
- The prepare_build_files hook is optional, and in its absence,
frontends can use build_sdist and extract the files to create a build
directory.
- Backends (like flit) where building an sdist has extra requirements
should define prepare_build_files.
Having two hooks still leaves us open to "VCS -> sdist -> build tree
-> wheel" and "VCS -> build tree -> wheel" giving different answers,
and that's specifically the loophole we're aiming to close by
including this in PEP 517 rather than leaving it until later.
Instead, the flow that I think makes sense is "VCS -> sdist tree [->
sdist tree -> sdist tree -> ...] -> wheel", and the above model where
the export filtering is only used when PKG-INFO doesn't exist yet will
give us that.