Skip to content
Draft
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
23 changes: 23 additions & 0 deletions python/tank/descriptor/io_descriptor/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from .path import IODescriptorPath

from ...util import process
from ... import LogManager

log = LogManager.get_logger(__name__)
Expand Down Expand Up @@ -53,3 +54,25 @@ def is_dev(self):
Returns true if this item is intended for development purposes
"""
return True

def get_version(self):
v = super().get_version()
if v.lower() != "undefined": # TODO constant
Copy link

Choose a reason for hiding this comment

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

Black would make changes.

return v

desc = self.get_git_output("describe", "--tags", "--first-parent")
if not desc:
return v

return desc.replace("-", "+dev-", 1)

def get_git_output(self, *args):
cmd_args = ["git", "-C", self._path]
cmd_args.extend(args)
try:
output = process.subprocess_check_output(cmd_args)
except process.SubprocessCalledProcessError as e:
Copy link

Choose a reason for hiding this comment

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

local variable 'e' is assigned to but never used

log.debug("Unable to run git command - {e}")
else:
# note: it seems on windows, the result is sometimes wrapped in single quotes.
return output.strip().strip("'")
Loading