コード例 #1
0
from weblate.vcs.git import GitRepository

from weblate.celery import app as celery_app

__all__ = ('celery_app',)


def get_root_dir():
    """Return Weblate root dir."""
    curdir = os.path.dirname(os.path.abspath(__file__))
    return os.path.abspath(os.path.join(curdir, '..'))


# Weblate version
VERSION = '3.5-dev'

# Version string without suffix
VERSION_BASE = VERSION.replace('-dev', '')

# User-Agent string to use
USER_AGENT = 'Weblate/{0}'.format(VERSION)

# Grab some information from git
try:
    # Describe current checkout
    GIT_VERSION = GitRepository(get_root_dir(), local=True).describe()
except (RepositoryException, OSError):
    # Import failed or git has troubles reading
    # repo (eg. swallow clone)
    GIT_VERSION = VERSION
コード例 #2
0
ファイル: __init__.py プロジェクト: alemansec/weblate
def get_root_dir():
    """Return Weblate root dir."""
    curdir = os.path.dirname(os.path.abspath(__file__))
    return os.path.abspath(os.path.join(curdir, ".."))


# Weblate version
VERSION = "4.3.1-dev"

# Version string without suffix
VERSION_BASE = VERSION.replace("-dev", "")

# User-Agent string to use
USER_AGENT = f"Weblate/{VERSION}"

# Git tag name for this release
TAG_NAME = f"weblate-{VERSION_BASE}"

# Grab some information from git
try:
    # Describe current checkout
    GIT_REPO = GitRepository(get_root_dir(), local=True)
    GIT_VERSION = GIT_REPO.describe()
    GIT_REVISION = GIT_REPO.last_revision
    del GIT_REPO
except (RepositoryException, OSError):
    # Import failed or git has troubles reading
    # repo (for example swallow clone)
    GIT_VERSION = VERSION
    GIT_REVISION = None