Skip to content

Commit

Permalink
fix: raise an error when SCM version can't be determined (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming authored Jun 8, 2023
1 parent cacf175 commit 001dfc8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/pdm/backend/hooks/version/scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,9 @@ def get_version_from_scm(root: str | Path, *, tag_regex: str | None = None) -> s
for func in (git_parse_version, hg_parse_version):
version = func(root, config) # type: ignore
if version:
break
else:
version = meta(config, "0.0.0")
assert version is not None
return format_version(version)
return format_version(version)
raise ValueError(
"Cannot find the version from SCM or SCM isn't detected. \n"
"You can still specify the version via environment variable "
"`PDM_BUILD_SCM_VERSION`."
)

0 comments on commit 001dfc8

Please sign in to comment.