[damned-lies] Removed requirement of an index.page for mallard docs



commit b8d91ef4c0f6b1a8230d863645d780dff7b8367e
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon Feb 3 20:15:15 2014 +0100

    Removed requirement of an index.page for mallard docs
    
    Fixes bug #695639.

 stats/utils.py |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/stats/utils.py b/stats/utils.py
index c391ad0..433a869 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -208,13 +208,12 @@ def generate_doc_pot_file(vcs_path, potbase, moduleid):
 
     doc_id = read_makefile_variable([vcs_path], "HELP_ID", default="NOTFOUND")
     uses_itstool = doc_id == "NOTFOUND" or bool(doc_id)
-    has_index_page = os.access(os.path.join(vcs_path, "C", "index.page"), os.R_OK)
-    doc_format = DocFormat(uses_itstool, has_index_page)
+    all_C_files = os.listdir(os.path.join(vcs_path, "C"))
+    has_page_files = any(f.endswith('.page') for f in all_C_files)
+    doc_format = DocFormat(is_itstool=uses_itstool, is_mallard=has_page_files)
 
     files = []
-    if doc_format.format == "mallard":
-        files.append("index.page")
-    else:
+    if doc_format.format == "docbook":
         modulename = read_makefile_variable([vcs_path], doc_format.module_var)
         if not modulename:
             return "", (("error", ugettext_noop("Module %s doesn't look like gnome-doc-utils module.") % 
moduleid),), doc_format
@@ -224,7 +223,7 @@ def generate_doc_pot_file(vcs_path, potbase, moduleid):
                 break
         if not files:
             # 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")]
+            xml_files = [f for f in all_C_files if f.endswith(".xml")]
             if len(xml_files) == 1:
                 files.append(os.path.basename(xml_files[0]))
             else:
@@ -236,8 +235,7 @@ def generate_doc_pot_file(vcs_path, potbase, moduleid):
         files.extend(filter(lambda x:x not in ("", "$(NULL)"), includes.split()))
     elif includes is None and doc_format.format == "mallard":
         # fallback to directory listing
-        files.extend([f for f in os.listdir(os.path.join(vcs_path, "C"))
-                      if f not in files and f.endswith(".page")])
+        files.extend([f for f in all_C_files if f.endswith(".page")])
 
     files = " ".join([os.path.join("C", f) for f in files])
     potfile = os.path.join(vcs_path, "C", potbase + ".pot")


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