def git_describe_version(): """Inspect the cola git repository and return the current version.""" if not os.path.isdir('.git') or not os.path.exists('cola/__init__.py'): raise VersionUnavailable('not a git-cola sandbox') v = git.execute(['git', 'describe', '--match=v[0-9]*', '--abbrev=7']) if v: return utils.strip_prefix('v', v.replace('-', '.')) else: raise VersionUnavailable('bad version: "%s"' % v)
"""Inspect the cola git repository and return the current version.""" try: v = git.Git.execute( ['git', 'describe', '--tags', '--match=v*', '--abbrev=7', 'HEAD'], with_stderr=True) except errors.GitCommandError, e: raise VersionUnavailable(str(e)) if v[0:1] != 'v' or not v[1:2].isdigit(): raise VersionUnavailable('%s: bad version' % v) try: dirty = git.Git.execute(['git', 'diff-index', '--name-only', 'HEAD']) except errors.GitCommandError, e: raise VersionUnavailable(str(e)) if dirty: v += '-dirty' return utils.strip_prefix('v', v.replace('-', '.')) def builtin_version(): """Return the builtin version or throw a VersionUnavailable exception""" try: from cola import builtin_version as bv except ImportError, e: raise VersionUnavailable() else: return bv.version @memoize def _builtin_version_file(ext='py'): """Returns the path to cola's builtin_version.py."""
'--tags', '--match=v*', '--abbrev=7', 'HEAD'], with_stderr=True) except errors.GitCommandError, e: raise VersionUnavailable(str(e)) if not re.match(r'^v[0-9]', v): raise VersionUnavailable('%s: bad version' % v) try: dirty = git.Git.execute(['git', 'diff-index', '--name-only', 'HEAD']) except errors.GitCommandError, e: raise VersionUnavailable(str(e)) if dirty: v += '-dirty' return re.sub('-', '.', utils.strip_prefix('v', v)) def builtin_version(): """Return the builtin version or throw a VersionUnavailable exception""" try: from cola import builtin_version as bv except ImportError, e: raise VersionUnavailable() else: return bv.version def _builtin_version_file(ext='py'): """Returns the path to cola's builtin_version.py.""" dirname = os.path.dirname(__file__)