build: add fallback version for builds without git metadata#120
Open
Qbushey wants to merge 1 commit into
Open
Conversation
hatch-vcs fails the build when the source tree has no git metadata (release tarballs, some AUR helper build dirs), which made 'python -m build --wheel' produce no dist/ output. Fixes caelestia-dots#81
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #81
When the source tree has no git metadata (release tarballs, some AUR helper build setups), hatch-vcs cannot determine a version and the build backend aborts, so
python -m build --wheelproduces nodist/directory and the subsequentpython -m installer dist/*.whlfails withFileNotFoundErrorThis is exactly the paru log in the issue.This adds setuptools-scm's
fallback_versionvia[tool.hatch.version.raw-options], so such builds succeed with version0.0.0instead of failing.Verified by building the same tree with and without
.git: without this change the no-git build errors out (ERROR Backend subprocess exited when trying to invoke build_wheel); with it,caelestia-0.0.0-py3-none-any.whlis produced. Builds from a proper git checkout are unaffected and keep their hatch-vcs derived version (the nix build is also unaffected as it setsSETUPTOOLS_SCM_PRETEND_VERSION).