1616# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818#
19- # $Id: setup.py,v 1.65 2004-05-13 20:12:32 a1s Exp $
19+ # $Id: setup.py,v 1.66 2004-05-14 18:32:58 a1s Exp $
2020
21+ from distutils import log
2122from distutils .core import setup , Extension
2223from distutils .util import get_platform
2324from distutils .command .build_scripts import build_scripts
@@ -132,8 +133,15 @@ def scriptname(path):
132133### Build Roundup
133134
134135def list_po_files ():
135- """Return list of all found message files"""
136- return glob ("locale/*/LC_MESSAGES/*.po" )
136+ """Return list of all found message files and their intallation paths"""
137+ _files = glob ("locale/*.po" )
138+ _list = []
139+ for _file in _files :
140+ # basename (without extension) is a locale name
141+ _locale = os .path .splitext (os .path .basename (_file ))[0 ]
142+ _list .append ((_file , os .path .join (
143+ "share" , "locale" , _locale , "LC_MESSAGES" , "roundup.mo" )))
144+ return _list
137145
138146def compile_po_files ():
139147 """Compile all .po files in locale directory"""
@@ -147,8 +155,13 @@ def compile_po_files():
147155 sys .path .insert (0 , os .path .join (_share , "Tools" , "i18n" ))
148156 import msgfmt
149157 # compile messages
150- for _file in list_po_files ():
151- msgfmt .make (_file , None )
158+ for (_po , _mo ) in list_po_files ():
159+ _mo = os .path .join ("build" , _mo )
160+ _dir = os .path .dirname (_mo )
161+ if not os .path .isdir (_dir ):
162+ os .makedirs (_dir )
163+ log .info ("Compiling messages in %r => %r" , _po , _mo )
164+ msgfmt .make (_po , _mo )
152165
153166def check_manifest ():
154167 """Check that the files listed in the MANIFEST are present when the
@@ -225,11 +238,9 @@ def main():
225238
226239 # add message files
227240 _po_files = list_po_files ()
228- for _file in _po_files :
229- # change .po to .mo - will be compiled by build
230- _file = os .path .splitext (_file )[0 ] + ".mo"
231- installdatafiles .append ((os .path .join ("share" , os .path .dirname (_file )),
232- [_file ]))
241+ for (_po_file , _mo_file ) in list_po_files ():
242+ installdatafiles .append ((os .path .dirname (_mo_file ),
243+ [os .path .join ("build" , _mo_file )]))
233244
234245 # perform the setup action
235246 from roundup import __version__
0 commit comments