summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2012-12-05 20:47:52 -0800
committerCarl Worth <cworth@cworth.org>2013-01-11 13:54:54 -0800
commitec04617fb36206863abfd3171876a52cbf4d9807 (patch)
treecab306b45b7a7aade342248211f04d55e496eae3 /src/mesa
parent11c3013610433758b6bcf5e29e0ddb0a5c1ecdd5 (diff)
downloadexternal_mesa3d-ec04617fb36206863abfd3171876a52cbf4d9807.zip
external_mesa3d-ec04617fb36206863abfd3171876a52cbf4d9807.tar.gz
external_mesa3d-ec04617fb36206863abfd3171876a52cbf4d9807.tar.bz2
driconf: Fix gen_xmlpool.py script to allow running from any directory
The gen_xmlpool.py script would work correctly only when executed from the directory that contained the script. This shortcoming was due to some hard-coded paths in the script. In order to easily invoke the script from the Android build system, we must be able to execute the script from an arbitrary directory. To enable that, this patch replaces the two hard-coded paths with new command line arguments. Signed-off-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Carl Worth <cworth@cworth.org>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/Makefile3
-rw-r--r--src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py19
2 files changed, 18 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile b/src/mesa/drivers/dri/common/xmlpool/Makefile
index b71629e..3b5e7db 100644
--- a/src/mesa/drivers/dri/common/xmlpool/Makefile
+++ b/src/mesa/drivers/dri/common/xmlpool/Makefile
@@ -61,8 +61,9 @@ clean:
-rm -rf $(LANGS)
# Default target options.h
+options.h: LOCALEDIR := .
options.h: t_options.h mo
- $(PYTHON2) $(PYTHON_FLAGS) gen_xmlpool.py $(LANGS) > options.h
+ $(PYTHON2) $(PYTHON_FLAGS) gen_xmlpool.py t_options.h $(LOCALEDIR) $(LANGS) > options.h
# Update .mo files from the corresponding .po files.
mo:
diff --git a/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py b/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
index 7398c4c..acfdcf4 100644
--- a/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
+++ b/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
@@ -1,11 +1,24 @@
#!/usr/bin/python
+#
+# Usage:
+# gen_xmlpool.py /path/to/t_option.h localedir lang lang lang ...
+#
+# For each given language, this script expects to find a .mo file at
+# `{localedir}/{language}/LC_MESSAGES/options.mo`.
+#
+
import sys
import gettext
import re
+# Path to t_options.h
+template_header_path = sys.argv[1]
+
+localedir = sys.argv[2]
+
# List of supported languages
-languages = sys.argv[1:]
+languages = sys.argv[3:]
# Escape special characters in C strings
def escapeCString (s):
@@ -134,7 +147,7 @@ def expandMatches (matches, translations, end=None):
translations = [("en", gettext.NullTranslations())]
for lang in languages:
try:
- trans = gettext.translation ("options", ".", [lang])
+ trans = gettext.translation ("options", localedir, [lang])
except IOError:
sys.stderr.write ("Warning: language '%s' not found.\n" % lang)
continue
@@ -155,7 +168,7 @@ print \
# Process the options template and generate options.h with all
# translations.
-template = file ("t_options.h", "r")
+template = file (template_header_path, "r")
descMatches = []
for line in template:
if len(descMatches) > 0: