File: release.py

package info (click to toggle)
django-countries 7.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,400 kB
  • sloc: python: 3,425; sh: 29; makefile: 17
file content (32 lines) | stat: -rw-r--r-- 800 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""
This file provides zest.releaser entrypoints using when releasing new
django-countries versions.
"""

import os

from django.core.management import call_command
from zest.releaser.utils import ask, execute_command  # type: ignore

import django_countries


def translations(data) -> None:
    if data["name"] != "django-countries":
        return

    if not ask("Pull translations from transifex and compile", default=True):
        return

    execute_command(["tx", "pull", "-a", "--minimum-perc=60"])
    _cwd = os.getcwd()
    os.chdir(os.path.dirname(django_countries.__file__))
    try:
        call_command("compilemessages")
        execute_command(["git", "add", "locale"])
    finally:
        os.chdir(_cwd)


if __name__ == "__main__":
    translations({"name": "django-countries"})