mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Upgrade to 3.0
This commit is contained in:
parent
9d215cd909
commit
6ed77fd7c0
5 changed files with 81 additions and 55 deletions
10
README.md
10
README.md
|
@ -8,6 +8,16 @@ The YunoHost team uses [Weblate](https://weblate.org) for translations: https://
|
||||||
|
|
||||||
An admin user is created at installation, the login is what you provided at installation, the password is **weblate**.
|
An admin user is created at installation, the login is what you provided at installation, the password is **weblate**.
|
||||||
|
|
||||||
|
## Weblate 3.0 upgrade
|
||||||
|
|
||||||
|
This upgrade is a major one, remember to read this page before upgrading: https://docs.weblate.org/en/latest/admin/upgrade.html#upgrade-3
|
||||||
|
|
||||||
|
After upgrading:
|
||||||
|
|
||||||
|
* All existing users and groups have been migrated to new model.
|
||||||
|
* Any per user permissions are removed, please assign users to appropriate groups and roles to grant them permissions.
|
||||||
|
* Any custom groups will not have any permissions after upgrade, please grant the permissions again.
|
||||||
|
|
||||||
## Github
|
## Github
|
||||||
|
|
||||||
You'll need to give weblate a github user and a token. Please read [github's documentation about token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
|
You'll need to give weblate a github user and a token. Please read [github's documentation about token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
|
||||||
|
|
|
@ -207,6 +207,9 @@ AUTHENTICATION_BACKENDS = (
|
||||||
'weblate.accounts.auth.WeblateUserBackend',
|
'weblate.accounts.auth.WeblateUserBackend',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Custom user model
|
||||||
|
AUTH_USER_MODEL = 'weblate_auth.User'
|
||||||
|
|
||||||
# Social auth backends setup
|
# Social auth backends setup
|
||||||
SOCIAL_AUTH_GITHUB_KEY = ''
|
SOCIAL_AUTH_GITHUB_KEY = ''
|
||||||
SOCIAL_AUTH_GITHUB_SECRET = ''
|
SOCIAL_AUTH_GITHUB_SECRET = ''
|
||||||
|
@ -308,7 +311,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
# 'NAME': 'zxcvbn_password.ZXCVBNValidator',
|
# 'NAME': 'zxcvbn_password.ZXCVBNValidator',
|
||||||
# 'OPTIONS': {
|
# 'OPTIONS': {
|
||||||
# 'min_score': 3,
|
# 'min_score': 3,
|
||||||
# 'user_attributes': ('username', 'email', 'first_name')
|
# 'user_attributes': ('username', 'email', 'full_name')
|
||||||
# }
|
# }
|
||||||
# },
|
# },
|
||||||
]
|
]
|
||||||
|
@ -348,6 +351,10 @@ INSTALLED_APPS = (
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework.authtoken',
|
'rest_framework.authtoken',
|
||||||
'weblate.addons',
|
'weblate.addons',
|
||||||
|
'weblate.auth',
|
||||||
|
'weblate.checks',
|
||||||
|
'weblate.formats',
|
||||||
|
'weblate.machinery',
|
||||||
'weblate.trans',
|
'weblate.trans',
|
||||||
'weblate.lang',
|
'weblate.lang',
|
||||||
'weblate.langdata',
|
'weblate.langdata',
|
||||||
|
@ -356,6 +363,7 @@ INSTALLED_APPS = (
|
||||||
'weblate.screenshots',
|
'weblate.screenshots',
|
||||||
'weblate.accounts',
|
'weblate.accounts',
|
||||||
'weblate.utils',
|
'weblate.utils',
|
||||||
|
'weblate.vcs',
|
||||||
'weblate.wladmin',
|
'weblate.wladmin',
|
||||||
'weblate',
|
'weblate',
|
||||||
|
|
||||||
|
@ -498,18 +506,18 @@ if not HAVE_SYSLOG:
|
||||||
del LOGGING['handlers']['syslog']
|
del LOGGING['handlers']['syslog']
|
||||||
|
|
||||||
# List of machine translations
|
# List of machine translations
|
||||||
# MACHINE_TRANSLATION_SERVICES = (
|
# MT_SERVICES = (
|
||||||
# 'weblate.trans.machine.apertium.ApertiumAPYTranslation',
|
# 'weblate.machinery.apertium.ApertiumAPYTranslation',
|
||||||
# 'weblate.trans.machine.deepl.DeepLTranslation',
|
# 'weblate.machinery.deepl.DeepLTranslation',
|
||||||
# 'weblate.trans.machine.glosbe.GlosbeTranslation',
|
# 'weblate.machinery.glosbe.GlosbeTranslation',
|
||||||
# 'weblate.trans.machine.google.GoogleTranslation',
|
# 'weblate.machinery.google.GoogleTranslation',
|
||||||
# 'weblate.trans.machine.microsoft.MicrosoftCognitiveTranslation',
|
# 'weblate.machinery.microsoft.MicrosoftCognitiveTranslation',
|
||||||
# 'weblate.trans.machine.mymemory.MyMemoryTranslation',
|
# 'weblate.machinery.mymemory.MyMemoryTranslation',
|
||||||
# 'weblate.trans.machine.tmserver.AmagamaTranslation',
|
# 'weblate.machinery.tmserver.AmagamaTranslation',
|
||||||
# 'weblate.trans.machine.tmserver.TMServerTranslation',
|
# 'weblate.machinery.tmserver.TMServerTranslation',
|
||||||
# 'weblate.trans.machine.yandex.YandexTranslation',
|
# 'weblate.machinery.yandex.YandexTranslation',
|
||||||
# 'weblate.trans.machine.weblatetm.WeblateTranslation',
|
# 'weblate.machinery.weblatetm.WeblateTranslation',
|
||||||
# 'weblate.trans.machine.saptranslationhub.SAPTranslationHub',
|
# 'weblate.machinery.saptranslationhub.SAPTranslationHub',
|
||||||
# 'weblate.memory.machine.WeblateMemory',
|
# 'weblate.memory.machine.WeblateMemory',
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
@ -615,36 +623,36 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||||
|
|
||||||
# List of quality checks
|
# List of quality checks
|
||||||
# CHECK_LIST = (
|
# CHECK_LIST = (
|
||||||
# 'weblate.trans.checks.same.SameCheck',
|
# 'weblate.checks.same.SameCheck',
|
||||||
# 'weblate.trans.checks.chars.BeginNewlineCheck',
|
# 'weblate.checks.chars.BeginNewlineCheck',
|
||||||
# 'weblate.trans.checks.chars.EndNewlineCheck',
|
# 'weblate.checks.chars.EndNewlineCheck',
|
||||||
# 'weblate.trans.checks.chars.BeginSpaceCheck',
|
# 'weblate.checks.chars.BeginSpaceCheck',
|
||||||
# 'weblate.trans.checks.chars.EndSpaceCheck',
|
# 'weblate.checks.chars.EndSpaceCheck',
|
||||||
# 'weblate.trans.checks.chars.EndStopCheck',
|
# 'weblate.checks.chars.EndStopCheck',
|
||||||
# 'weblate.trans.checks.chars.EndColonCheck',
|
# 'weblate.checks.chars.EndColonCheck',
|
||||||
# 'weblate.trans.checks.chars.EndQuestionCheck',
|
# 'weblate.checks.chars.EndQuestionCheck',
|
||||||
# 'weblate.trans.checks.chars.EndExclamationCheck',
|
# 'weblate.checks.chars.EndExclamationCheck',
|
||||||
# 'weblate.trans.checks.chars.EndEllipsisCheck',
|
# 'weblate.checks.chars.EndEllipsisCheck',
|
||||||
# 'weblate.trans.checks.chars.EndSemicolonCheck',
|
# 'weblate.checks.chars.EndSemicolonCheck',
|
||||||
# 'weblate.trans.checks.chars.MaxLengthCheck',
|
# 'weblate.checks.chars.MaxLengthCheck',
|
||||||
# 'weblate.trans.checks.format.PythonFormatCheck',
|
# 'weblate.checks.format.PythonFormatCheck',
|
||||||
# 'weblate.trans.checks.format.PythonBraceFormatCheck',
|
# 'weblate.checks.format.PythonBraceFormatCheck',
|
||||||
# 'weblate.trans.checks.format.PHPFormatCheck',
|
# 'weblate.checks.format.PHPFormatCheck',
|
||||||
# 'weblate.trans.checks.format.CFormatCheck',
|
# 'weblate.checks.format.CFormatCheck',
|
||||||
# 'weblate.trans.checks.format.PerlFormatCheck',
|
# 'weblate.checks.format.PerlFormatCheck',
|
||||||
# 'weblate.trans.checks.format.JavascriptFormatCheck',
|
# 'weblate.checks.format.JavascriptFormatCheck',
|
||||||
# 'weblate.trans.checks.consistency.PluralsCheck',
|
# 'weblate.checks.consistency.PluralsCheck',
|
||||||
# 'weblate.trans.checks.consistency.SamePluralsCheck',
|
# 'weblate.checks.consistency.SamePluralsCheck',
|
||||||
# 'weblate.trans.checks.consistency.ConsistencyCheck',
|
# 'weblate.checks.consistency.ConsistencyCheck',
|
||||||
# 'weblate.trans.checks.consistency.TranslatedCheck',
|
# 'weblate.checks.consistency.TranslatedCheck',
|
||||||
# 'weblate.trans.checks.chars.NewlineCountingCheck',
|
# 'weblate.checks.chars.NewlineCountingCheck',
|
||||||
# 'weblate.trans.checks.markup.BBCodeCheck',
|
# 'weblate.checks.markup.BBCodeCheck',
|
||||||
# 'weblate.trans.checks.chars.ZeroWidthSpaceCheck',
|
# 'weblate.checks.chars.ZeroWidthSpaceCheck',
|
||||||
# 'weblate.trans.checks.markup.XMLValidityCheck',
|
# 'weblate.checks.markup.XMLValidityCheck',
|
||||||
# 'weblate.trans.checks.markup.XMLTagsCheck',
|
# 'weblate.checks.markup.XMLTagsCheck',
|
||||||
# 'weblate.trans.checks.source.OptionalPluralCheck',
|
# 'weblate.checks.source.OptionalPluralCheck',
|
||||||
# 'weblate.trans.checks.source.EllipsisCheck',
|
# 'weblate.checks.source.EllipsisCheck',
|
||||||
# 'weblate.trans.checks.source.MultipleFailingCheck',
|
# 'weblate.checks.source.MultipleFailingCheck',
|
||||||
# )
|
# )
|
||||||
|
|
||||||
# List of automatic fixups
|
# List of automatic fixups
|
||||||
|
@ -662,21 +670,17 @@ CRISPY_TEMPLATE_PACK = 'bootstrap3'
|
||||||
# 'weblate.addons.gettext.UpdateConfigureAddon',
|
# 'weblate.addons.gettext.UpdateConfigureAddon',
|
||||||
# 'weblate.addons.gettext.MsgmergeAddon',
|
# 'weblate.addons.gettext.MsgmergeAddon',
|
||||||
# 'weblate.addons.gettext.GettextCustomizeAddon',
|
# 'weblate.addons.gettext.GettextCustomizeAddon',
|
||||||
|
# 'weblate.addons.gettext.GettextAuthorComments',
|
||||||
# 'weblate.addons.cleanup.CleanupAddon',
|
# 'weblate.addons.cleanup.CleanupAddon',
|
||||||
|
# 'weblate.addons.consistency.LangaugeConsistencyAddon',
|
||||||
|
# 'weblate.addons.discovery.DiscoveryAddon',
|
||||||
# 'weblate.addons.flags.SourceEditAddon',
|
# 'weblate.addons.flags.SourceEditAddon',
|
||||||
# 'weblate.addons.flags.TargetEditAddon',
|
# 'weblate.addons.flags.TargetEditAddon',
|
||||||
# 'weblate.addons.json.JSONCustomizeAddon',
|
|
||||||
# 'weblate.addons.generate.GenerateFileAddon',
|
# 'weblate.addons.generate.GenerateFileAddon',
|
||||||
|
# 'weblate.addons.json.JSONCustomizeAddon',
|
||||||
# 'weblate.addons.properties.PropertiesSortAddon',
|
# 'weblate.addons.properties.PropertiesSortAddon',
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
|
||||||
# List of scripts to use in custom processing
|
|
||||||
# POST_UPDATE_SCRIPTS = (
|
|
||||||
# )
|
|
||||||
# PRE_COMMIT_SCRIPTS = (
|
|
||||||
# )
|
|
||||||
|
|
||||||
# E-mail address that error messages come from.
|
# E-mail address that error messages come from.
|
||||||
SERVER_EMAIL = 'noreply@__DOMAIN__'
|
SERVER_EMAIL = 'noreply@__DOMAIN__'
|
||||||
|
|
||||||
|
@ -728,7 +732,7 @@ REST_FRAMEWORK = {
|
||||||
),
|
),
|
||||||
'PAGE_SIZE': 20,
|
'PAGE_SIZE': 20,
|
||||||
'VIEW_DESCRIPTION_FUNCTION': 'weblate.api.views.get_view_description',
|
'VIEW_DESCRIPTION_FUNCTION': 'weblate.api.views.get_view_description',
|
||||||
'UNAUTHENTICATED_USER': 'weblate.accounts.models.get_anonymous',
|
'UNAUTHENTICATED_USER': 'weblate.auth.models.get_anonymous',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Example for restricting access to logged in users
|
# Example for restricting access to logged in users
|
||||||
|
@ -751,4 +755,3 @@ REST_FRAMEWORK = {
|
||||||
|
|
||||||
# Force sane test runner
|
# Force sane test runner
|
||||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"description": {
|
"description": {
|
||||||
"en": "A translation platform using Git and Python"
|
"en": "A translation platform using Git and Python"
|
||||||
},
|
},
|
||||||
"version": "2.20-1",
|
"version": "3.0~ynh1",
|
||||||
"url": "https://weblate.org",
|
"url": "https://weblate.org",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
current_version="2.20"
|
current_version="3.0"
|
||||||
|
|
||||||
ynh_check_global_uwsgi_config () {
|
ynh_check_global_uwsgi_config () {
|
||||||
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
|
||||||
|
|
|
@ -203,6 +203,8 @@ then
|
||||||
# send diff to the server administrator
|
# send diff to the server administrator
|
||||||
mail_message="
|
mail_message="
|
||||||
Weblate was updated from version $previous_version to $current_version
|
Weblate was updated from version $previous_version to $current_version
|
||||||
|
This is a MAJOR upgrade, please read this:
|
||||||
|
https://docs.weblate.org/en/latest/admin/upgrade.html#upgrade-3
|
||||||
|
|
||||||
A new settings.py has been created in:
|
A new settings.py has been created in:
|
||||||
$settings
|
$settings
|
||||||
|
@ -236,6 +238,17 @@ fi
|
||||||
set -o nounset
|
set -o nounset
|
||||||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||||
cd "${final_path}"
|
cd "${final_path}"
|
||||||
|
|
||||||
|
# https://docs.weblate.org/en/latest/admin/upgrade.html#upgrade-3
|
||||||
|
# https://github.com/WeblateOrg/docker/blob/386aa8d98bb57dfec3707680827d4e4f4d79e3fd/start#L81-L88
|
||||||
|
weblate showmigrations --plan > /tmp/migrations.txt
|
||||||
|
if grep -Fq '[X] auth.0001_initial' /tmp/migrations.txt && grep -Fq '[ ] weblate_auth.0001_initial' /tmp/migrations.txt ; then
|
||||||
|
ynh_replace_string "AUTH_USER_MODEL" "#AUTH_USER_MODEL" "$settings"
|
||||||
|
weblate migrate weblate_auth 0001
|
||||||
|
ynh_replace_string "#AUTH_USER_MODEL" "AUTH_USER_MODEL" "$settings"
|
||||||
|
fi
|
||||||
|
ynh_secure_remove /tmp/migrations.txt
|
||||||
|
|
||||||
weblate migrate --noinput
|
weblate migrate --noinput
|
||||||
weblate collectstatic --noinput
|
weblate collectstatic --noinput
|
||||||
weblate setuplang
|
weblate setuplang
|
||||||
|
|
Loading…
Reference in a new issue