|
16 | 16 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
17 | 17 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
18 | 18 | # |
19 | | -# $Id: setup.py,v 1.67 2004-05-16 09:23:18 a1s Exp $ |
| 19 | +# $Id: setup.py,v 1.68 2004-05-18 19:46:35 a1s Exp $ |
20 | 20 |
|
21 | 21 | from distutils.core import setup, Extension |
22 | 22 | from distutils.util import get_platform |
@@ -131,9 +131,9 @@ def scriptname(path): |
131 | 131 |
|
132 | 132 | ### Build Roundup |
133 | 133 |
|
134 | | -def list_po_files(): |
| 134 | +def list_message_files(suffix=".mo"): |
135 | 135 | """Return list of all found message files and their intallation paths""" |
136 | | - _files = glob("locale/*.po") |
| 136 | + _files = glob("locale/*" + suffix) |
137 | 137 | _list = [] |
138 | 138 | for _file in _files: |
139 | 139 | # basename (without extension) is a locale name |
@@ -166,41 +166,16 @@ def check_manifest(): |
166 | 166 |
|
167 | 167 | class build_roundup(build): |
168 | 168 |
|
169 | | - user_options = build.user_options + [ |
170 | | - ("python-tools=", "p", "Python tools directory"), |
171 | | - ] |
172 | | - |
173 | | - def initialize_options (self): |
174 | | - build.initialize_options(self) |
175 | | - self.python_tools = None |
176 | | - |
177 | | - def finalize_options (self): |
178 | | - build.finalize_options(self) |
179 | | - if self.python_tools is None: |
180 | | - if sys.platform == "win32": |
181 | | - _share = sys.prefix |
182 | | - else: |
183 | | - _share = os.path.join(sys.prefix, "share", |
184 | | - "python%i.%i" % sys.version_info[:2]) |
185 | | - self.python_tools = os.path.join(_share, "Tools") |
186 | | - |
187 | | - def compile_po_files(self): |
188 | | - """Compile all .po files in locale directory""" |
189 | | - # import message formatter |
190 | | - sys.path.insert(0, os.path.join(self.python_tools, "i18n")) |
191 | | - import msgfmt |
192 | | - # compile messages |
193 | | - for (_po, _mo) in list_po_files(): |
194 | | - _mo = os.path.join("build", _mo) |
195 | | - _dir = os.path.dirname(_mo) |
196 | | - if not os.path.isdir(_dir): |
197 | | - os.makedirs(_dir) |
198 | | - self.announce("Compiling messages in %r => %r" % (_po, _mo)) |
199 | | - msgfmt.make(_po, _mo) |
| 169 | + def build_message_files(self): |
| 170 | + """Copy all .mo files to their locale directories""" |
| 171 | + for (_src, _dst) in list_message_files(): |
| 172 | + _build_dst = os.path.join("build", _dst) |
| 173 | + self.mkpath(os.path.dirname(_build_dst)) |
| 174 | + self.copy_file(_src, _build_dst) |
200 | 175 |
|
201 | 176 | def run(self): |
202 | 177 | check_manifest() |
203 | | - self.compile_po_files() |
| 178 | + self.build_message_files() |
204 | 179 | build.run(self) |
205 | 180 |
|
206 | 181 | ############################################################################# |
@@ -249,8 +224,7 @@ def main(): |
249 | 224 | ) |
250 | 225 |
|
251 | 226 | # add message files |
252 | | - _po_files = list_po_files() |
253 | | - for (_po_file, _mo_file) in list_po_files(): |
| 227 | + for (_dist_file, _mo_file) in list_message_files(): |
254 | 228 | installdatafiles.append((os.path.dirname(_mo_file), |
255 | 229 | [os.path.join("build", _mo_file)])) |
256 | 230 |
|
|
0 commit comments