def post_migrate(self, sender, **kwargs): ensure_ssh_key() home = data_dir("home") # Configure merge driver for Gettext PO # We need to do this behind lock to avoid errors when servers # start in parallel lockfile = WeblateLock(home, "gitlock", 0, "", "lock:{scope}", "{scope}", timeout=120) with lockfile: try: GitRepository.global_setup() except RepositoryException as error: GIT_ERRORS.append(str(error)) if SubversionRepository.is_supported(): try: SubversionRepository.global_setup() except RepositoryException as error: GIT_ERRORS.append(str(error)) # Use it for *.po by default configdir = os.path.join(home, ".config", "git") configfile = os.path.join(configdir, "attributes") if not os.path.exists(configfile): if not os.path.exists(configdir): os.makedirs(configdir) with open(configfile, "w") as handle: handle.write("*.po merge=weblate-merge-gettext-po\n")
def ready(self): home = data_dir('home') if not os.path.exists(home): os.makedirs(home) # Configure merge driver for Gettext PO # We need to do this behind lock to avoid errors when servers # start in parallel lockfile = FileLock(os.path.join(home, 'gitlock')) with lockfile: try: GitRepository.global_setup() delete_configuration_error('Git global setup') except RepositoryException as error: add_configuration_error( 'Git global setup', 'Failed to do git setup: {0}'.format(error)) # Use it for *.po by default configdir = os.path.join(home, '.config', 'git') configfile = os.path.join(configdir, 'attributes') if not os.path.exists(configfile): if not os.path.exists(configdir): os.makedirs(configdir) with open(configfile, 'w') as handle: handle.write('*.po merge=weblate-merge-gettext-po\n')
def ready(self): super().ready() register(check_vcs) register(check_git, deploy=True) register(check_gpg, deploy=True) home = data_dir("home") if not os.path.exists(home): os.makedirs(home) # Configure merge driver for Gettext PO # We need to do this behind lock to avoid errors when servers # start in parallel lockfile = WeblateLock(home, "gitlock", 0, "", "lock:{scope}", "{scope}", timeout=120) with lockfile: try: GitRepository.global_setup() except RepositoryException as error: GIT_ERRORS.append(str(error)) # Use it for *.po by default configdir = os.path.join(home, ".config", "git") configfile = os.path.join(configdir, "attributes") if not os.path.exists(configfile): if not os.path.exists(configdir): os.makedirs(configdir) with open(configfile, "w") as handle: handle.write("*.po merge=weblate-merge-gettext-po\n")
def ready(self): super().ready() register(check_vcs) home = data_dir("home") if not os.path.exists(home): os.makedirs(home) # Configure merge driver for Gettext PO # We need to do this behind lock to avoid errors when servers # start in parallel lockfile = FileLock(os.path.join(home, "gitlock")) with lockfile: try: GitRepository.global_setup() delete_configuration_error("Git global setup") except RepositoryException as error: add_configuration_error( "Git global setup", "Failed to do git setup: {0}".format(error)) # Use it for *.po by default configdir = os.path.join(home, ".config", "git") configfile = os.path.join(configdir, "attributes") if not os.path.exists(configfile): if not os.path.exists(configdir): os.makedirs(configdir) with open(configfile, "w") as handle: handle.write("*.po merge=weblate-merge-gettext-po\n")
def get_versions(): """Return list of used versions.""" result = [get_version_module(name) for name in REQUIRES] result.append(("Python", "https://www.python.org/", sys.version.split()[0])) try: result.append(("Git", "https://git-scm.com/", GitRepository.get_version())) except OSError: raise ImproperlyConfigured("Failed to run git, please install it.") return result
def ready(self): # Configure merge driver for Gettext PO # We need to do this behind lock to avoid errors when servers # start in parallel lockfile = FileLock(os.path.join(data_dir('home'), 'gitlock')) with lockfile: try: GitRepository.global_setup() except RepositoryException as error: add_configuration_error( 'Git global setup', 'Failed to do git setup: {0}'.format(error) ) # Use it for *.po by default configdir = os.path.join(data_dir('home'), '.config', 'git') configfile = os.path.join(configdir, 'attributes') if not os.path.exists(configfile): if not os.path.exists(configdir): os.makedirs(configdir) with open(configfile, 'w') as handle: handle.write('*.po merge=weblate-merge-gettext-po\n')
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
def setUpClass(cls): super().setUpClass() # Global setup to configure git committer GitRepository.global_setup()
def get_versions(): """Return list of used versions.""" result = [] result.append(( 'Python', 'https://www.python.org/', sys.version.split()[0], '2.7', )) result.append( get_single( 'Django', 'https://www.djangoproject.com/', '1.11', )) result.append( get_single( 'Celery', 'http://www.celeryproject.org/', '4.0', )) result.append( get_single( 'celery-batches', 'https://pypi.org/project/celery-batches/', '0.2', )) result.append(get_single( 'six', 'https://pypi.org/project/six/', '1.7.0', )) result.append( get_single( 'social-auth-core', 'https://python-social-auth.readthedocs.io/', '3.1.0', )) result.append( get_single( 'social-auth-app-django', 'https://python-social-auth.readthedocs.io/', '3.1.0', )) result.append( get_single('django-appconf', 'https://github.com/django-compressor/django-appconf', '1.0')) result.append( get_single( 'translate-toolkit', 'https://toolkit.translatehouse.org/', '2.3.1', )) result.append( get_single( 'translation-finder', 'https://github.com/WeblateOrg/translation-finder', '1.4', )) result.append( get_single( 'Whoosh', 'https://bitbucket.org/mchaput/whoosh/', '2.7', )) result.append( get_single( 'defusedxml', 'https://bitbucket.org/tiran/defusedxml', '0.4', )) try: result.append(( 'Git', 'https://git-scm.com/', GitRepository.get_version(), '1.6', )) except OSError: raise ImproperlyConfigured('Failed to run git, please install it.') result.append(get_single( 'Pillow', 'https://python-pillow.org/', '1.1.6', )) result.append( get_single('python-dateutil', 'https://labix.org/python-dateutil', '1.0')) result.append(get_single( 'lxml', 'https://lxml.de/', '3.5.0', )) result.append( get_single( 'django-crispy-forms', 'https://django-crispy-forms.readthedocs.io/', '1.6.1', )) result.append( get_single( 'django_compressor', 'https://github.com/django-compressor/django-compressor', '2.1', )) result.append( get_single( 'djangorestframework', 'https://www.django-rest-framework.org/', '3.8', )) result.append( get_single( 'user-agents', 'https://github.com/selwin/python-user-agents', '1.1.0', )) result.append( get_single( 'jellyfish', 'https://github.com/jamesturk/jellyfish', '0.6.1', )) result.append( get_single( 'diff-match-patch', 'https://github.com/diff-match-patch-python/diff-match-patch', '20121119', )) return result
def get_versions(): """Return list of used versions.""" result = [] result.append(( 'Python', 'https://www.python.org/', sys.version.split()[0], '2.7', )) result.append(get_single( 'Django', 'https://www.djangoproject.com/', 'django', '1.11', 'get_version' )) result.append(get_single( 'six', 'https://pypi.python.org/pypi/six', 'six', '1.7.0', )) result.append(get_single( 'social-auth-core', 'https://python-social-auth.readthedocs.io/', 'social_core', '1.3.0', )) result.append(get_single( 'social-auth-app-django', 'https://python-social-auth.readthedocs.io/', 'social_django', '1.2.0', )) result.append(get_single( 'django-appconf', 'https://github.com/django-compressor/django-appconf', 'appconf', '1.0' )) result.append(get_single( 'Translate Toolkit', 'http://toolkit.translatehouse.org/', 'translate.__version__', '2.3.0', 'sver', )) result.append(get_single( 'Whoosh', 'https://bitbucket.org/mchaput/whoosh/', 'whoosh', '2.7', 'versionstring', )) result.append(get_single( 'defusedxml', 'https://bitbucket.org/tiran/defusedxml', 'defusedxml', '0.4', )) try: result.append(( 'Git', 'https://git-scm.com/', GitRepository.get_version(), '1.6', )) except OSError: raise ImproperlyConfigured('Failed to run git, please install it.') result.append(get_single( 'Pillow (PIL)', 'https://python-pillow.org/', 'PIL.Image', '1.1.6', 'VERSION', )) result.append(get_single( 'dateutil', 'https://labix.org/python-dateutil', 'dateutil', '1.0' )) result.append(get_single( 'lxml', 'http://lxml.de/', 'lxml.etree', '3.1.0', )) result.append(get_single( 'django-crispy-forms', 'https://django-crispy-forms.readthedocs.io/', 'crispy_forms', '1.6.1', )) result.append(get_single( 'compressor', 'https://github.com/django-compressor/django-compressor', 'compressor', '2.1', )) result.append(get_single( 'djangorestframework', 'http://www.django-rest-framework.org/', 'rest_framework', '3.8', )) result.append(get_single( 'user-agents', 'https://github.com/selwin/python-user-agents', 'user_agents', '1.1.0', 'VERSION', )) return result
def get_versions(): """Return list of used versions.""" result = [] result.append(( 'Python', 'https://www.python.org/', sys.version.split()[0], '2.7', )) result.append( get_single('Django', 'https://www.djangoproject.com/', 'django', '1.11', 'get_version')) result.append( get_single( 'six', 'https://pypi.python.org/pypi/six', 'six', '1.7.0', )) result.append( get_single( 'social-auth-core', 'https://python-social-auth.readthedocs.io/', 'social_core', '1.3.0', )) result.append( get_single( 'social-auth-app-django', 'https://python-social-auth.readthedocs.io/', 'social_django', '1.2.0', )) result.append( get_single('django-appconf', 'https://github.com/django-compressor/django-appconf', 'appconf', '1.0')) result.append( get_single( 'Translate Toolkit', 'http://toolkit.translatehouse.org/', 'translate.__version__', '2.3.0', 'sver', )) result.append( get_single( 'Whoosh', 'https://bitbucket.org/mchaput/whoosh/', 'whoosh', '2.7', 'versionstring', )) result.append( get_single( 'defusedxml', 'https://bitbucket.org/tiran/defusedxml', 'defusedxml', '0.4', )) try: result.append(( 'Git', 'https://git-scm.com/', GitRepository.get_version(), '1.6', )) except OSError: raise ImproperlyConfigured('Failed to run git, please install it.') result.append( get_single( 'Pillow (PIL)', 'https://python-pillow.org/', 'PIL.Image', '1.1.6', 'VERSION', )) result.append( get_single('dateutil', 'https://labix.org/python-dateutil', 'dateutil', '1.0')) result.append( get_single( 'lxml', 'http://lxml.de/', 'lxml.etree', '3.1.0', )) result.append( get_single( 'django-crispy-forms', 'https://django-crispy-forms.readthedocs.io/', 'crispy_forms', '1.6.1', )) result.append( get_single( 'compressor', 'https://github.com/django-compressor/django-compressor', 'compressor', '2.1', )) result.append( get_single( 'djangorestframework', 'http://www.django-rest-framework.org/', 'rest_framework', '3.8', )) result.append( get_single( 'user-agents', 'https://github.com/selwin/python-user-agents', 'user_agents', '1.1.0', 'VERSION', )) return result
def get_versions(): """Return list of used versions.""" result = [] result.append(( 'Python', 'https://www.python.org/', sys.version.split()[0], '2.7', )) result.append(get_single( 'Django', 'https://www.djangoproject.com/', 'django', '1.11', )) result.append(get_single( 'Celery', 'http://www.celeryproject.org/', 'celery', '4.0', )) result.append(get_single( 'celery-batches', 'https://pypi.org/project/celery-batches/', 'celery_batches', '0.2', )) result.append(get_single( 'six', 'https://pypi.org/project/six/', 'six', '1.7.0', )) result.append(get_single( 'social-auth-core', 'https://python-social-auth.readthedocs.io/', 'social_core', '2.0.0', )) result.append(get_single( 'social-auth-app-django', 'https://python-social-auth.readthedocs.io/', 'social_django', '3.0.0', )) result.append(get_single( 'django-appconf', 'https://github.com/django-compressor/django-appconf', 'appconf', '1.0' )) result.append(get_single( 'translate-toolkit', 'https://toolkit.translatehouse.org/', 'translate', '2.3.1', )) result.append(get_single( 'Whoosh', 'https://bitbucket.org/mchaput/whoosh/', 'whoosh', '2.7', )) result.append(get_single( 'defusedxml', 'https://bitbucket.org/tiran/defusedxml', 'defusedxml', '0.4', )) try: result.append(( 'Git', 'https://git-scm.com/', GitRepository.get_version(), '1.6', )) except OSError: raise ImproperlyConfigured('Failed to run git, please install it.') result.append(get_single( 'Pillow', 'https://python-pillow.org/', 'PIL.Image', '1.1.6', )) result.append(get_single( 'python-dateutil', 'https://labix.org/python-dateutil', 'dateutil', '1.0' )) result.append(get_single( 'lxml', 'https://lxml.de/', 'lxml.etree', '3.1.0', )) result.append(get_single( 'django-crispy-forms', 'https://django-crispy-forms.readthedocs.io/', 'crispy_forms', '1.6.1', )) result.append(get_single( 'django_compressor', 'https://github.com/django-compressor/django-compressor', 'compressor', '2.1', )) result.append(get_single( 'djangorestframework', 'https://www.django-rest-framework.org/', 'rest_framework', '3.8', )) result.append(get_single( 'user-agents', 'https://github.com/selwin/python-user-agents', 'user_agents', '1.1.0', )) result.append(get_single( 'jellyfish', 'https://github.com/jamesturk/jellyfish', 'jellyfish', '0.6.1', )) result.append(get_single( 'diff-match-patch', 'https://github.com/diff-match-patch-python/diff-match-patch', 'diff_match_patch', '20121119', )) return result