Skip to content

Commit

Permalink
Change local versioning scheme to node-and-date
Browse files Browse the repository at this point in the history
  • Loading branch information
domna committed Nov 1, 2023
1 parent 9d77ced commit da552b7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pynxtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#
import os
import re
from datetime import datetime
from glob import glob
from typing import Union

Expand All @@ -32,12 +33,13 @@
def _build_version(tag: str, distance: int, node: str, dirty: bool) -> str:
"""
Builds the version string for a given set of git states.
This resembles `no-guess-dev` + `dirty-tag` behavior from setuptools_scm.
This resembles `no-guess-dev` + `node-and-date` behavior from setuptools_scm.
"""
if distance == 0 and not dirty:
return f"{tag}"

return f"{tag}.post1.dev{distance}+{'dirty' if dirty else node}"
dirty_appendix = datetime.now().strftime(".d%Y%m%d") if dirty else ""
return f"{tag}.post1.dev{distance}+{node}{dirty_appendix}"


def format_version(version: str) -> str:
Expand Down
10 changes: 9 additions & 1 deletion pynxtools/_build_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ def get_vcs_version(tag_match="*[0-9]*") -> Optional[str]:
try:
return (
run(
["git", "describe", "--tags", "--long", "--match", tag_match],
[
"git",
"describe",
"--dirty",
"--tags",
"--long",
"--match",
tag_match,
],
cwd=os.path.join(os.path.dirname(__file__), "../pynxtools/definitions"),
check=True,
capture_output=True,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ exclude = ["pynxtools/definitions*"]

[tool.setuptools_scm]
version_scheme = "no-guess-dev"
local_scheme = "dirty-tag"
local_scheme = "node-and-date"

0 comments on commit da552b7

Please sign in to comment.