Projet

Général

Profil

« Précédent | Suivant » 

Révision b51a06ed

Ajouté par Serghei Mihai il y a environ 8 ans

setup.py: add locales

Update manifest

Voir les différences:

setup.py
5 5
import os
6 6
import re
7 7
import subprocess
8
import sys
8 9

  
10
from setuptools.command.install_lib import install_lib as _install_lib
11
from distutils.command.build import build as _build
9 12
from distutils.command.sdist import sdist
10 13
from setuptools import setup, find_packages
11 14

  
15
from distutils.cmd import Command
16

  
17

  
12 18
class eo_sdist(sdist):
13 19
    def run(self):
14 20
        if os.path.exists('VERSION'):
......
36 42
            return version
37 43
    return '0'
38 44

  
45
class compile_translations(Command):
46
    description = 'compile message catalogs to MO files via django compilemessages'
47
    user_options = []
48

  
49
    def initialize_options(self):
50
        pass
51

  
52
    def finalize_options(self):
53
        pass
54

  
55
    def run(self):
56
        try:
57
            from django.core.management import call_command
58
            for path, dirs, files in os.walk('corbo'):
59
                if 'locale' not in dirs:
60
                    continue
61
                curdir = os.getcwd()
62
                os.chdir(os.path.realpath(path))
63
                call_command('compilemessages')
64
                os.chdir(curdir)
65
        except ImportError:
66
            sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
67

  
68
class build(_build):
69
    sub_commands = [('compile_translations', None)] + _build.sub_commands
70

  
71

  
72
class install_lib(_install_lib):
73
    def run(self):
74
        self.run_command('compile_translations')
75
        _install_lib.run(self)
39 76

  
40 77
setup(
41 78
    name='corbo',
......
61 98
        'gadjo'
62 99
        ],
63 100
    zip_safe=False,
101
    cmdclass={
102
        'build': build,
103
        'compile_translations': compile_translations,
104
        'install_lib': install_lib,
105
        'sdist': eo_sdist,
106
    },
107

  
64 108
)

Formats disponibles : Unified diff