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
1=== modified file 'utils/buildcat.py'
2--- utils/buildcat.py 2010-04-16 22:48:20 +0000
3+++ utils/buildcat.py 2010-07-26 22:18:48 +0000
4@@ -21,6 +21,7 @@
5 import re
6 import string
7 import sys
8+import subprocess
9 sys.path.append('build/scons-tools')
10 from detect_revision import detect_revision
11 from time import strftime,gmtime
12@@ -93,7 +94,17 @@
13 RE_NO_DOTFILE="^[^\.]" # Matches everything but dot-leaded filenames.
14 RE_ISO639="^[a-z]{2,2}(_[A-Z]{2,2})?$" # Matches ISO-639 language codes
15 # structure. Note that this doesn't
16- # garantees correctness of code.
17+ # garantees correctness of code.
18+
19+#Mac OS X hack to support XCode and macports default path
20+MACPORTSPATH = "/opt/local/bin/"
21+MSGMERGE = "msgmerge"
22+if os.path.isfile(MACPORTSPATH + MSGMERGE) and os.access(MACPORTSPATH + MSGMERGE, os.X_OK):
23+ MSGMERGE = MACPORTSPATH + MSGMERGE
24+
25+XGETTEXT = "xgettext"
26+if os.path.isfile(MACPORTSPATH + XGETTEXT) and os.access(MACPORTSPATH + XGETTEXT, os.X_OK):
27+ XGETTEXT = MACPORTSPATH + XGETTEXT
28
29 # Options passed to common external programs
30 XGETTEXTOPTS ="-k_ --from-code=UTF-8"
31@@ -182,8 +193,8 @@
32 ##############################################################################
33 def do_compile_src( potfile, srcfiles ):
34 # call xgettext and supply source filenames via stdin
35- gettext_input = os.popen("xgettext %s --files-from=- --output=%s" % \
36- (XGETTEXTOPTS, potfile), "w")
37+ gettext_input = subprocess.Popen(XGETTEXT + " %s --files-from=- --output=%s" % \
38+ (XGETTEXTOPTS, potfile), shell=True, stdin=subprocess.PIPE).stdin
39 try:
40 for one_pattern in srcfiles:
41 # 'normpath' is necessary for windows ('/' vs. '\')
42@@ -299,7 +310,7 @@
43 #
44 ##############################################################################
45 def do_buildpo(po, pot, dst):
46- rv = os.system("msgmerge %s %s %s -o %s" % (MSGMERGEOPTS, po, pot, dst))
47+ rv = os.system(MSGMERGE + " %s %s %s -o %s" % (MSGMERGEOPTS, po, pot, dst))
48 if rv:
49 raise RuntimeError("msgmerge exited with errorcode %i!" % rv)
50 return rv
51
52=== modified file 'utils/buildlocale.py'
53--- utils/buildlocale.py 2010-03-24 12:26:58 +0000
54+++ utils/buildlocale.py 2010-07-26 22:18:48 +0000
55@@ -19,6 +19,12 @@
56
57 import buildcat
58
59+#Mac OS X hack to support XCode and macports default path
60+MACPORTSPATH = "/opt/local/bin/"
61+MSGFMT = "msgfmt"
62+if os.path.isfile(MACPORTSPATH + MSGFMT) and os.access(MACPORTSPATH + MSGFMT, os.X_OK):
63+ MSGFMT = MACPORTSPATH + MSGFMT
64+
65 ##############################################################################
66 #
67 # Merge & compile every .po file found in 'po/lang' directory
68@@ -36,7 +42,7 @@
69
70 if not buildcat.do_buildpo(po, pot, "tmp.po"):
71 buildcat.do_makedirs(os.path.dirname(mo))
72- err_code = os.system("msgfmt -o %s tmp.po" % mo)
73+ err_code = os.system(MSGFMT + " -o %s tmp.po" % mo)
74 if not err_code: # Success
75 os.remove("tmp.po")
76 sys.stdout.write(".")

Subscribers

People subscribed via source and target branches

to status/vote changes: