-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure PDM to avoid +local version suffix on clean builds.
- Loading branch information
1 parent
179c4e6
commit 4c0935d
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
from datetime import datetime | ||
from pdm.backend.hooks.version import SCMVersion | ||
|
||
|
||
def format_version(version: SCMVersion) -> str: | ||
major, minor = (int(n) for n in str(version.version).split(".")[:2]) | ||
dirty = f"+{datetime.utcnow():%Y%m%d.%H%M%S}" if version.dirty else "" | ||
if version.distance is None: | ||
return f"{major}.{minor}{dirty}" | ||
else: | ||
return f"{major}.{minor}.dev{version.distance}{dirty}" |
This file contains 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