view kallithea/lib/vcs/conf/settings.py @ 8270:5725fa4cfecd

cleanup: minimize use of lambda expressions - we have 'def' for that purpose Fix some flake8 warnings "E731 do not assign a lambda expression, use a def".
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 04 Aug 2019 00:07:10 +0200
parents 08eec03c9485
children c33d3aa26c19
line wrap: on
line source

import os
import tempfile

from kallithea.lib.vcs.utils import aslist
from kallithea.lib.vcs.utils.paths import get_user_home


def abspath(*p):
    return os.path.abspath(os.path.join(*p))

VCSRC_PATH = os.environ.get('VCSRC_PATH')

if not VCSRC_PATH:
    HOME_ = get_user_home()
    if not HOME_:
        HOME_ = tempfile.gettempdir()

VCSRC_PATH = VCSRC_PATH or abspath(HOME_, '.vcsrc')
if os.path.isdir(VCSRC_PATH):
    VCSRC_PATH = os.path.join(VCSRC_PATH, '__init__.py')

# list of default encoding used in safe_str/safe_bytes methods
DEFAULT_ENCODINGS = aslist('utf-8')

# path to git executable run by run_git_command function
GIT_EXECUTABLE_PATH = 'git'
# can be also --branches --tags
GIT_REV_FILTER = '--all'

BACKENDS = {
    'hg': 'kallithea.lib.vcs.backends.hg.MercurialRepository',
    'git': 'kallithea.lib.vcs.backends.git.GitRepository',
}

ARCHIVE_SPECS = {
    'tar': ('application/x-tar', '.tar'),
    'tbz2': ('application/x-bzip2', '.tar.bz2'),
    'tgz': ('application/x-gzip', '.tar.gz'),
    'zip': ('application/zip', '.zip'),
}