Skip to content

Commit 930a555

Browse files
author
Alexander Smishlajev
committed
don't compile message catalogs...
...his must be done by running GNU make in the 'locale' dir. the 'build' step only builds runtime directory structure for these files.
1 parent 1cc6b8b commit 930a555

File tree

1 file changed

+11
-37
lines changed

1 file changed

+11
-37
lines changed

setup.py

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
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 $
2020

2121
from distutils.core import setup, Extension
2222
from distutils.util import get_platform
@@ -131,9 +131,9 @@ def scriptname(path):
131131

132132
### Build Roundup
133133

134-
def list_po_files():
134+
def list_message_files(suffix=".mo"):
135135
"""Return list of all found message files and their intallation paths"""
136-
_files = glob("locale/*.po")
136+
_files = glob("locale/*" + suffix)
137137
_list = []
138138
for _file in _files:
139139
# basename (without extension) is a locale name
@@ -166,41 +166,16 @@ def check_manifest():
166166

167167
class build_roundup(build):
168168

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)
200175

201176
def run(self):
202177
check_manifest()
203-
self.compile_po_files()
178+
self.build_message_files()
204179
build.run(self)
205180

206181
#############################################################################
@@ -249,8 +224,7 @@ def main():
249224
)
250225

251226
# 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():
254228
installdatafiles.append((os.path.dirname(_mo_file),
255229
[os.path.join("build", _mo_file)]))
256230

0 commit comments

Comments
 (0)