Skip to content

Commit b76c81d

Browse files
committed
added timestamp version format function
1 parent 2521712 commit b76c81d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

setuptools_scm/version.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,20 @@ def get_local_node_and_date(version):
144144
return version.format_choice("+{node}", "+{node}.d{time:%Y%m%d}")
145145

146146

147+
def get_local_node_and_timestamp(version, fmt='%Y%m%d%H%M%S'):
148+
if version.exact or version.node is None:
149+
return version.format_choice("",
150+
"+d{time:"
151+
+ "{fmt}".format(fmt=fmt)
152+
+ "}")
153+
else:
154+
return version.format_choice("+{node}",
155+
"+{node}"
156+
+ ".d{time:"
157+
+ "{fmt}".format(fmt=fmt)
158+
+ "}")
159+
160+
147161
def get_local_dirty_tag(version):
148162
return version.format_choice('', '+dirty')
149163

0 commit comments

Comments
 (0)