Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def parse(root):

[setuptools_scm.local_scheme]
node-and-date = setuptools_scm.version:get_local_node_and_date
node-and-timestamp = \
setuptools_scm.version:get_local_node_and_timestamp
dirty-tag = setuptools_scm.version:get_local_dirty_tag
""",
classifiers=[
Expand Down
14 changes: 14 additions & 0 deletions setuptools_scm/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ def get_local_node_and_date(version):
return version.format_choice("+{node}", "+{node}.d{time:%Y%m%d}")


def get_local_node_and_timestamp(version, fmt='%Y%m%d%H%M%S'):
if version.exact or version.node is None:
return version.format_choice("",
"+d{time:"
+ "{fmt}".format(fmt=fmt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should use nested replacements as per https://www.python.org/dev/peps/pep-3101/#format-specifiers

this needs an api addition however

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a follow-up issue was created

+ "}")
else:
return version.format_choice("+{node}",
"+{node}"
+ ".d{time:"
+ "{fmt}".format(fmt=fmt)
+ "}")


def get_local_dirty_tag(version):
return version.format_choice('', '+dirty')

Expand Down