##// END OF EJS Templates
i18n: new build_mo command for setup.py...
Martin Geisler -
r7649:a489e3a9 default
parent child Browse files
Show More
@@ -28,6 +28,7 b' Output/Mercurial-*.exe'
28 tags
28 tags
29 cscope.*
29 cscope.*
30 i18n/hg.pot
30 i18n/hg.pot
31 locale/*/LC_MESSAGES/hg.mo
31
32
32 syntax: regexp
33 syntax: regexp
33 ^\.pc/
34 ^\.pc/
@@ -31,6 +31,8 b' import shutil'
31 import tempfile
31 import tempfile
32 from distutils.core import setup, Extension
32 from distutils.core import setup, Extension
33 from distutils.command.install_data import install_data
33 from distutils.command.install_data import install_data
34 from distutils.command.build import build
35 from distutils.spawn import spawn, find_executable
34 from distutils.ccompiler import new_compiler
36 from distutils.ccompiler import new_compiler
35
37
36 extra = {}
38 extra = {}
@@ -115,7 +117,38 b' class install_package_data(install_data)'
115 ('install_lib', 'install_dir'))
117 ('install_lib', 'install_dir'))
116 install_data.finalize_options(self)
118 install_data.finalize_options(self)
117
119
118 cmdclass = {'install_data': install_package_data}
120 class build_mo(build):
121
122 description = "build translations (.mo files)"
123
124 def run(self):
125 if not find_executable('msgfmt'):
126 self.warn("could not find msgfmt executable, no translations "
127 "will be built")
128 return
129
130 podir = 'i18n'
131 if not os.path.isdir(podir):
132 self.warn("could not find %s/ directory" % podir)
133 return
134
135 join = os.path.join
136 for po in os.listdir(podir):
137 if not po.endswith('.po'):
138 continue
139 pofile = join(podir, po)
140 modir = join('locale', po[:-3], 'LC_MESSAGES')
141 mofile = join(modir, 'hg.mo')
142 self.mkpath(modir)
143 self.make_file([pofile], mofile, spawn,
144 (['msgfmt', '-o', mofile, pofile],))
145 self.distribution.data_files.append((join('mercurial', modir),
146 [mofile]))
147
148 build.sub_commands.append(('build_mo', None))
149
150 cmdclass = {'install_data': install_package_data,
151 'build_mo': build_mo}
119
152
120 ext_modules=[
153 ext_modules=[
121 Extension('mercurial.base85', ['mercurial/base85.c']),
154 Extension('mercurial.base85', ['mercurial/base85.c']),
General Comments 0
You need to be logged in to leave comments. Login now