widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #03388
[Merge] lp:~hjd/widelands/utils-buildcat into lp:widelands
Hans Joachim Desserud has proposed merging lp:~hjd/widelands/utils-buildcat into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~hjd/widelands/utils-buildcat/+merge/244683
My hobby: browsing utils/
I found a couple of things, have tweaked some of them and need some feedback on others.
What I've done:
- Removed the find_executable method which should be unnecessary. If someone has installed gettext in an odd location, please add it to PATH and rerun the script.
Though I don't have much experience with these scripts it seems to still work fine.
- Removed a reference to files which doesn't exist anymore.
What remains (possibly)
- I am not sure whether buildlocale is still needed. According to the win32 readme, it's supposed to compile translation files, but but this should already be done by po/CMakeLists.txt.
- If the above is true, more tweaks to the readme plus removal of win32/buildcat.sh
--
Your team Widelands Developers is requested to review the proposed merge of lp:~hjd/widelands/utils-buildcat into lp:widelands.
=== modified file 'utils/buildcat.py'
--- utils/buildcat.py 2014-12-07 10:00:08 +0000
+++ utils/buildcat.py 2014-12-14 12:12:15 +0000
@@ -118,26 +118,6 @@
),
]
-# Paths to search for exectuables
-PATHS = [
- "/bin", "/usr/bin",
- "/opt/local/bin", "/sw/bin",
- "/usr/local/bin"
-]
-def find_exectuable(cmd):
- """
- Try to find the executable given some paths. Defaults to just return
- the cmd if it is not found in any paths
- """
- for p in PATHS:
- full_path = os.path.join(p, cmd)
- if os.path.isfile(full_path) and os.access(full_path, os.X_OK):
- return full_path
- return cmd
-
-MSGMERGE = find_exectuable("msgmerge")
-XGETTEXT = find_exectuable("xgettext")
-
# Options passed to common external programs
XGETTEXTOPTS ="-k_ --from-code=UTF-8"
@@ -146,14 +126,12 @@
XGETTEXTOPTS+=" --copyright-holder=\"Widelands Development Team\""
XGETTEXTOPTS+=" --msgid-bugs-address=\"https://bugs.launchpad.net/widelands\""
-MSGMERGEOPTS="-q --no-wrap"
-
def are_we_in_root_directory():
"""Make sure we are called in the root directory"""
if (not os.path.isdir("po")):
- print "Error: no 'po/' subdir found.\n"
- print ("This script needs to access translations placed " +
+ print("Error: no 'po/' subdir found.\n")
+ print("This script needs to access translations placed " +
"under 'po/' subdir, but these seem unavailable. Check " +
"that you called this script from Widelands' main dir.\n")
sys.exit(1)
@@ -202,7 +180,7 @@
and write out the given potfile
"""
# call xgettext and supply source filenames via stdin
- gettext_input = subprocess.Popen(XGETTEXT + " %s --files-from=- --output=%s" % \
+ gettext_input = subprocess.Popen("xgettext %s --files-from=- --output=%s" % \
(XGETTEXTOPTS, potfile), shell=True, stdin=subprocess.PIPE).stdin
try:
for one_pattern in srcfiles:
@@ -211,7 +189,7 @@
for one_file in glob(os.path.normpath(one_pattern)):
gettext_input.write(one_file + "\n")
return gettext_input.close()
- except IOError, err_msg:
+ except IOError as err_msg:
sys.stderr.write("Failed to call xgettext: %s\n" % err_msg)
return -1
@@ -286,7 +264,8 @@
#
##############################################################################
def do_buildpo(po, pot, dst):
- rv = os.system(MSGMERGE + " %s %s %s -o %s" % (MSGMERGEOPTS, po, pot, dst))
+ msgmergeopts="-q --no-wrap"
+ rv = os.system("msgmerge %s %s %s -o %s" % (msgmergeopts, po, pot, dst))
if rv:
raise RuntimeError("msgmerge exited with errorcode %i!" % rv)
return rv
@@ -370,4 +349,4 @@
# Make sure .pot files are up to date.
do_update_potfiles()
- print ""
+ print("")
=== modified file 'utils/buildlocale.py'
--- utils/buildlocale.py 2011-05-05 17:32:50 +0000
+++ utils/buildlocale.py 2014-12-14 12:12:15 +0000
@@ -16,8 +16,6 @@
import buildcat
-MSGFMT = buildcat.find_exectuable("msgfmt")
-
def do_compile(lang):
"""Merge and compile every .po file found in po/lang"""
sys.stdout.write("\t%s:\t" % lang)
@@ -31,7 +29,7 @@
if not buildcat.do_buildpo(po, pot, "tmp.po"):
buildcat.do_makedirs(os.path.dirname(mo))
- err_code = os.system(MSGFMT + " -o %s tmp.po" % mo)
+ err_code = os.system("msgfmt -o %s tmp.po" % mo)
if not err_code: # Success
os.remove("tmp.po")
sys.stdout.write(".")
@@ -59,7 +57,7 @@
# Find every directory that looks like ISO-639
lang = set(p.splitext(p.basename(l))[0] for
l in glob("po/*/*.po"))
- print "all available."
+ print("all available.")
for l in lang:
do_compile(l)
=== modified file 'utils/win32/README.WIN32'
--- utils/win32/README.WIN32 2008-10-04 17:57:09 +0000
+++ utils/win32/README.WIN32 2014-12-14 12:12:15 +0000
@@ -1,7 +1,6 @@
This directory holds tools and scripts for win32-system users.
* you can run buildcat.sh in msys (with installed python) to compile
the gettext translation files
-* You can find a Makefile for mingw-gcc >= 4.1 in subdirectory "mingw"
* You can find an InnoSetup-Script "Widelands.iss" for packing your
compiled Widelands build in subdiretory "innosetup".
- the needed software can be find at http://www.jrsoftware.org
\ No newline at end of file
+ the needed software can be find at http://www.jrsoftware.org