[library-web] Add some support for tarballs using yelp-tools (GNOME bug 656738)



commit a9a220479ba9631a84bed7aaa9f3380d668fead7
Author: FrÃdÃric PÃters <fpeters 0d be>
Date:   Fri Sep 30 19:57:03 2011 +0200

    Add some support for tarballs using yelp-tools (GNOME bug 656738)

 src/lgo.py              |    5 ++++-
 src/modtypes/base.py    |    7 +++----
 src/modtypes/mallard.py |    7 ++++---
 3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/lgo.py b/src/lgo.py
index bc45901..929453d 100755
--- a/src/lgo.py
+++ b/src/lgo.py
@@ -497,7 +497,10 @@ class Lgo(App):
                 makefile_am = fd.read()
                 # merge lines continued with \
                 makefile_am = re.sub(r'\\\s*\n', r' ', makefile_am)
-                if 'DOC_ID' in makefile_am and regex_gdu.findall(makefile_am):
+                if 'HELP_ID' in makefile_am and '@YELP_HELP_RULES@' in makefile_am:
+                    logging.debug('found usage of mallard (via YELP_HELP_RULES) in %s' % tarinfo.name)
+                    doc = MallardModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
+                elif 'DOC_ID' in makefile_am and regex_gdu.findall(makefile_am):
                     logging.debug('found usage of mallard in %s' % tarinfo.name)
                     doc = MallardModule.create_from_tar(tar, tarinfo, makefile_am, nightly)
                 elif 'DOC_MODULE' in makefile_am and regex_gdu.findall(makefile_am):
diff --git a/src/modtypes/base.py b/src/modtypes/base.py
index 543fe2a..cba66c6 100644
--- a/src/modtypes/base.py
+++ b/src/modtypes/base.py
@@ -47,10 +47,9 @@ class DocModule(object):
             self.dirname = os.path.dirname(tarinfo.name)
         if makefile_am:
             self.makefile_am = makefile_am
-            try:
-                self.modulename = re.findall(r'DOC_ID\s?=\s?(.*)', makefile_am)[0].strip()
-            except IndexError:
-                self.modulename = re.findall(r'DOC_MODULE\s?=\s?(.*)', makefile_am)[0].strip()
+            self.modulename = re.findall(r'(?:DOC_ID|DOC_MODULE|HELP_ID)\s?=\s?(.*)',
+                                makefile_am)[0].strip()
+
             if '@' in self.modulename:
                 logging.warning('variadic module name: %s' % self.modulename)
                 # don't go interpreting autotools variables, as in this path
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index 6b7956a..2f613e1 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -202,7 +202,7 @@ class MallardModule(DocModule):
         ext_dirname = os.path.join(app.config.private_dir, 'extracts')
 
         try:
-            doc_linguas = re.findall(r'DOC_LINGUAS\s+=[\t ](.*)',
+            doc_linguas = re.findall(r'(?:DOC_LINGUAS|HELP_LINGUAS)\s+=[\t ](.*)',
                     self.makefile_am)[0].split()
             if not 'en' in doc_linguas:
                 doc_linguas.append('en')
@@ -210,12 +210,13 @@ class MallardModule(DocModule):
             doc_linguas = ['en']
 
         try:
-            doc_pages = re.findall('DOC_PAGES\s+=\s+(.*)', self.makefile_am)[0].split()
+            doc_pages = re.findall(r'(?:DOC_PAGES|HELP_FILES)\s+=\s+(.*)',
+                                   self.makefile_am)[0].split()
         except IndexError:
             return
 
         try:
-            doc_figures = re.findall('DOC_FIGURES\s+=\s+(.*)',
+            doc_figures = re.findall(r'(?:DOC_FIGURES|HELP_FIGURES)\s+=\s+(.*)',
                     self.makefile_am)[0].split()
             figures_dirname = os.path.join(ext_dirname, self.dirname, 'C')
             self.expand_doc_figures(doc_figures)



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