Re: [Widelands-public] [SOLVED] buildlocale/buildcat problem on win32
Status: Beta
Brought to you by:
sirver
From: Philipp N. <wid...@az...> - 2007-06-20 22:23:48
|
Hi again! On Mon, Jun 18, 2007 at 11:49:58PM +0200, Philipp Niemann wrote: > The locales are not build correctly with utils/buildlocale.py, which calls > or rather imports utils/buildcat.py. This patch does the trick. Thanks for the input to all! ----- Index: buildcat.py =================================================================== --- buildcat.py (revision 2325) +++ buildcat.py (working copy) @@ -73,7 +73,7 @@ # Options passed to common external programs XGETTEXTOPTS ="-k_ --from-code=UTF-8" -XGETTEXTOPTS+=" --copyright-holder='Widelands Development Team'" +XGETTEXTOPTS+=" --copyright-holder=\"Widelands Development Team\"" XGETTEXTOPTS+=" --msgid-bugs-address='wid...@li...'" MSGMERGEOPTS="-q --no-wrap" @@ -141,10 +141,20 @@ # ############################################################################## def do_compile_src( potfile, srcfiles ): - return os.system("xgettext %s -o %s %s" % (XGETTEXTOPTS, potfile, - string.join(srcfiles))) + files = [] + for i in srcfiles: + files += glob(i) + + fh = open("buildcat.tmp", "w") + for i in files: + fh.write( os.path.normpath(i) + "\n" ) + fh.close() + return os.system("xgettext %s -o %s %s" % (XGETTEXTOPTS, potfile, + "-f buildcat.tmp")) + + ############################################################################## # # Return a list of directories under a given preffix, matching regular ----- I had to compile gettext-0.16.1 first, which took some changes to the source to work out. I updated the wiki accordingly. The patch changes XGETTEXTOPTS to get proper handling of the spaces in copyright-holder. The use of ' (single quote) has no effect on win32. Furthermore the patch uses a temporary file to store the filenames used as input files to xgettext. Every other try to combine the filenames on a single commandline has failed on my win32 box. This intermediate file should be removed, of course. Tough removing it with the clean or distclean target might be sufficient. You are welcome to implement something better! This works on both my linux and windows installation. I especially would appreciate a smarter handling of the tempfile. It could use a secure filename (Yeah! "The use of mktemp is insecure, consider using mkstemp instead" ;-) and unlink that file after closing it. Build a simple textbased X Server in elisp and run that within emacs to show the user the content of the tempfile after the build and have the user choose if she wants to remove the file or not presenting a nice gtkbased screen dialog. Maybe I should stop using windows ;) Bye, Philipp PS: Please tell if you like me to upload this to svn. I won't do so now, as I think this is quite messy a patch to commit. |