Merge lp:~widelands-dev/widelands/fix-bug-582561 into lp:widelands

Proposed by David Allwicher
Status: Merged
Merged at revision: 5456
Proposed branch: lp:~widelands-dev/widelands/fix-bug-582561
Merge into: lp:widelands
Diff against target: 76 lines (+22/-5)
2 files modified
utils/buildcat.py (+15/-4)
utils/buildlocale.py (+7/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/fix-bug-582561
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+31001@code.launchpad.net

Commit message

Description of the change

Makes buildcat.py and buildlocale.py executable inside Xcode with installation of msgfmt, msgmerge and xgettext in /opt/local (macports default path)

Adds a strange preference towards the opt/local installation path.

Removes os.popen because it is deprecated.

To post a comment you must log in.
Revision history for this message
SirVer (sirver) wrote :

I approve of the os.popen chance. I trust that the Xcode work around is necessary as I have no experience there :).

Applied in r5456.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'utils/buildcat.py'
--- utils/buildcat.py 2010-04-16 22:48:20 +0000
+++ utils/buildcat.py 2010-07-26 22:18:48 +0000
@@ -21,6 +21,7 @@
21import re21import re
22import string22import string
23import sys23import sys
24import subprocess
24sys.path.append('build/scons-tools')25sys.path.append('build/scons-tools')
25from detect_revision import detect_revision26from detect_revision import detect_revision
26from time import strftime,gmtime27from time import strftime,gmtime
@@ -93,7 +94,17 @@
93RE_NO_DOTFILE="^[^\.]" # Matches everything but dot-leaded filenames.94RE_NO_DOTFILE="^[^\.]" # Matches everything but dot-leaded filenames.
94RE_ISO639="^[a-z]{2,2}(_[A-Z]{2,2})?$" # Matches ISO-639 language codes95RE_ISO639="^[a-z]{2,2}(_[A-Z]{2,2})?$" # Matches ISO-639 language codes
95 # structure. Note that this doesn't96 # structure. Note that this doesn't
96 # garantees correctness of code.97 # garantees correctness of code.
98
99#Mac OS X hack to support XCode and macports default path
100MACPORTSPATH = "/opt/local/bin/"
101MSGMERGE = "msgmerge"
102if os.path.isfile(MACPORTSPATH + MSGMERGE) and os.access(MACPORTSPATH + MSGMERGE, os.X_OK):
103 MSGMERGE = MACPORTSPATH + MSGMERGE
104
105XGETTEXT = "xgettext"
106if os.path.isfile(MACPORTSPATH + XGETTEXT) and os.access(MACPORTSPATH + XGETTEXT, os.X_OK):
107 XGETTEXT = MACPORTSPATH + XGETTEXT
97108
98# Options passed to common external programs109# Options passed to common external programs
99XGETTEXTOPTS ="-k_ --from-code=UTF-8"110XGETTEXTOPTS ="-k_ --from-code=UTF-8"
@@ -182,8 +193,8 @@
182##############################################################################193##############################################################################
183def do_compile_src( potfile, srcfiles ):194def do_compile_src( potfile, srcfiles ):
184 # call xgettext and supply source filenames via stdin195 # call xgettext and supply source filenames via stdin
185 gettext_input = os.popen("xgettext %s --files-from=- --output=%s" % \196 gettext_input = subprocess.Popen(XGETTEXT + " %s --files-from=- --output=%s" % \
186 (XGETTEXTOPTS, potfile), "w")197 (XGETTEXTOPTS, potfile), shell=True, stdin=subprocess.PIPE).stdin
187 try:198 try:
188 for one_pattern in srcfiles:199 for one_pattern in srcfiles:
189 # 'normpath' is necessary for windows ('/' vs. '\')200 # 'normpath' is necessary for windows ('/' vs. '\')
@@ -299,7 +310,7 @@
299#310#
300##############################################################################311##############################################################################
301def do_buildpo(po, pot, dst):312def do_buildpo(po, pot, dst):
302 rv = os.system("msgmerge %s %s %s -o %s" % (MSGMERGEOPTS, po, pot, dst))313 rv = os.system(MSGMERGE + " %s %s %s -o %s" % (MSGMERGEOPTS, po, pot, dst))
303 if rv:314 if rv:
304 raise RuntimeError("msgmerge exited with errorcode %i!" % rv)315 raise RuntimeError("msgmerge exited with errorcode %i!" % rv)
305 return rv316 return rv
306317
=== modified file 'utils/buildlocale.py'
--- utils/buildlocale.py 2010-03-24 12:26:58 +0000
+++ utils/buildlocale.py 2010-07-26 22:18:48 +0000
@@ -19,6 +19,12 @@
1919
20import buildcat20import buildcat
2121
22#Mac OS X hack to support XCode and macports default path
23MACPORTSPATH = "/opt/local/bin/"
24MSGFMT = "msgfmt"
25if os.path.isfile(MACPORTSPATH + MSGFMT) and os.access(MACPORTSPATH + MSGFMT, os.X_OK):
26 MSGFMT = MACPORTSPATH + MSGFMT
27
22##############################################################################28##############################################################################
23#29#
24# Merge & compile every .po file found in 'po/lang' directory30# Merge & compile every .po file found in 'po/lang' directory
@@ -36,7 +42,7 @@
3642
37 if not buildcat.do_buildpo(po, pot, "tmp.po"):43 if not buildcat.do_buildpo(po, pot, "tmp.po"):
38 buildcat.do_makedirs(os.path.dirname(mo))44 buildcat.do_makedirs(os.path.dirname(mo))
39 err_code = os.system("msgfmt -o %s tmp.po" % mo)45 err_code = os.system(MSGFMT + " -o %s tmp.po" % mo)
40 if not err_code: # Success46 if not err_code: # Success
41 os.remove("tmp.po")47 os.remove("tmp.po")
42 sys.stdout.write(".")48 sys.stdout.write(".")

Subscribers

People subscribed via source and target branches

to status/vote changes: