Skip to content

Commit

Permalink
fix: fallback version to 0.0.0 when empty
Browse files Browse the repository at this point in the history
FIx #3163

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Sep 19, 2024
1 parent 5db006a commit 4d880cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/3163.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fallback version to 0.0.0 when the version is not specified or empty. This can avoid crash when building such project.
2 changes: 1 addition & 1 deletion src/pdm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def normalize_name(name: str, lowercase: bool = True) -> str:

def comparable_version(version: str) -> Version:
"""Normalize a version to make it valid in a specifier."""
parsed = parse_version(version)
parsed = parse_version(version or "0.0.0")
if parsed.local is not None:
# strip the local part
parsed._version = parsed._version._replace(local=None)
Expand Down

0 comments on commit 4d880cc

Please sign in to comment.