[damned-lies] Add a last-resort method to get main xml file for a documentation



commit 3852e3a0a11aa4488f0803601833389481484eed
Author: Claude Paroz <claude 2xlibre net>
Date:   Fri Apr 30 20:27:42 2010 +0200

    Add a last-resort method to get main xml file for a documentation
    
    This will be used by gtkmm-documentation where there is a -in.xml
    file which doesn't contain code examples. However this is fine for
    translation as examples are not translated.

 stats/utils.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/stats/utils.py b/stats/utils.py
index cd086e1..7883430 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -133,8 +133,13 @@ def generate_doc_pot_file(vcs_path, potbase, moduleid, verbose):
                 errors.append(("warn", ugettext_noop("DOC_MODULE doesn't resolve to a real file, using '%s.xml'.") % (moduleid)))
                 modulename = moduleid
             else:
-                errors.append(("error", ugettext_noop("DOC_MODULE doesn't point to a real file, probably a macro.")))
-                return "", errors
+                # Last try: only one xml file in C/...
+                xml_files = [f for f in os.listdir(os.path.join(vcs_path, "C")) if f.endswith(".xml")]
+                if len(xml_files) == 1:
+                    modulename = os.path.basename(xml_files[0])[:-4]
+                else:
+                    errors.append(("error", ugettext_noop("DOC_MODULE doesn't point to a real file, probably a macro.")))
+                    return "", errors
         files = os.path.join("C", modulename + ".xml")
 
     includes = read_makefile_variable([vcs_path], "DOC_INCLUDES")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]