1515# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
1616# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
18- #
19- # $Id: setup.py,v 1.64 2004-05-05 02:05:43 richard Exp $
18+ #
19+ # $Id: setup.py,v 1.65 2004-05-13 20:12:32 a1s Exp $
2020
2121from distutils .core import setup , Extension
2222from distutils .util import get_platform
@@ -51,7 +51,7 @@ class (due to the delayed instantiation of command classes
5151 <packagename>.scripts.<mangled_scriptname>
5252
5353 The mangling of script names replaces '-' and '/' characters
54- with '-' and '.', so that they are valid module paths.
54+ with '-' and '.', so that they are valid module paths.
5555 """
5656 package_name = None
5757
@@ -61,7 +61,7 @@ def copy_scripts(self):
6161 if not self .package_name :
6262 raise Exception ("You have to inherit build_scripts_create and"
6363 " provide a package name" )
64-
64+
6565 to_module = string .maketrans ('-/' , '_.' )
6666
6767 self .mkpath (self .build_dir )
@@ -129,6 +129,27 @@ def scriptname(path):
129129 script = script + ".bat"
130130 return script
131131
132+ ### Build Roundup
133+
134+ def list_po_files ():
135+ """Return list of all found message files"""
136+ return glob ("locale/*/LC_MESSAGES/*.po" )
137+
138+ def compile_po_files ():
139+ """Compile all .po files in locale directory"""
140+ # locate the tools directory
141+ if sys .platform == "win32" :
142+ _share = sys .prefix
143+ else :
144+ _share = os .path .join (sys .prefix , "share" ,
145+ "python%i.%i" % sys .version_info [:2 ])
146+ # import message formatter
147+ sys .path .insert (0 , os .path .join (_share , "Tools" , "i18n" ))
148+ import msgfmt
149+ # compile messages
150+ for _file in list_po_files ():
151+ msgfmt .make (_file , None )
152+
132153def check_manifest ():
133154 """Check that the files listed in the MANIFEST are present when the
134155 source is unpacked.
@@ -154,6 +175,7 @@ def check_manifest():
154175class build_roundup (build ):
155176 def run (self ):
156177 check_manifest ()
178+ compile_po_files ()
157179 build .run (self )
158180
159181#############################################################################
@@ -176,7 +198,7 @@ def main():
176198 ]
177199 installdatafiles = [
178200 ('share/roundup/cgi-bin' , ['cgi-bin/roundup.cgi' ]),
179- ]
201+ ]
180202
181203 # install man pages on POSIX platforms
182204 if os .name == 'posix' :
@@ -201,15 +223,23 @@ def main():
201223 (os .path .join ('share' , 'roundup' , idir ), tfiles )
202224 )
203225
226+ # add message files
227+ _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 ]))
233+
204234 # perform the setup action
205235 from roundup import __version__
206236 setup (
207- name = "roundup" ,
237+ name = "roundup" ,
208238 version = __version__ ,
209239 description = "A simple-to-use and -install issue-tracking system"
210240 " with command-line, web and e-mail interfaces. Highly"
211241 " customisable." ,
212- long_description =
242+ long_description =
213243'''Roundup is a simple-to-use and -install issue-tracking system with
214244command-line, web and e-mail interfaces. It is based on the winning design
215245from Ka-Ping Yee in the Software Carpentry "Track" design competition.
0 commit comments