[library-web] do not fail on gtk-doc modules missing a html/ directory



commit 11188584ee4d37b22e33a555c8301f2b567d2834
Author: Frédéric Péters <fpeters 0d be>
Date:   Thu Aug 6 22:14:16 2009 +0200

    do not fail on gtk-doc modules missing a html/ directory

 src/modtypes/gtkdoc.py |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/src/modtypes/gtkdoc.py b/src/modtypes/gtkdoc.py
index 7858a94..869652d 100644
--- a/src/modtypes/gtkdoc.py
+++ b/src/modtypes/gtkdoc.py
@@ -103,6 +103,12 @@ class GtkDocModule(DocModule):
                     # documentation and would require a full module build to get
                     # them properly.  (happens with GTK+)
 
+                    htmlfiles_dir = os.path.join(ext_dirname, self.dirname, 'html')
+                    if not os.path.exists(htmlfiles_dir):
+                        # tarball shipped without an HTML version of the
+                        # documentation, can't do anything here :/
+                        logging.error('skipped %s as it is missing an html/ dir' % doc_module)
+                        return
                     if html5lib:
                         # convert files to XML, then process them with xsltproc
                         # to get library.gnome.org look
@@ -110,10 +116,8 @@ class GtkDocModule(DocModule):
                         logging.debug('transforming files shipped with tarball')
                         parser = html5lib.HTMLParser()
 
-                        for filename in os.listdir(os.path.join(
-                                    ext_dirname, self.dirname, 'html')):
-                            src = os.path.join(
-                                    ext_dirname, self.dirname, 'html', filename)
+                        for filename in os.listdir(htmlfiles_dir):
+                            src = os.path.join(htmlfiles_dir,filename)
                             dst = os.path.join(web_output_dir, filename)
                             if not filename.endswith('.html'):
                                 open(dst, 'w').write(open(src, 'r').read())
@@ -134,9 +138,8 @@ class GtkDocModule(DocModule):
                     else:
                         # simply copy files shipped in tarball
                         logging.debug('copying files shipped with tarball')
-                        for filename in os.listdir(os.path.join(
-                                    ext_dirname, self.dirname, 'html')):
-                            src = os.path.join(ext_dirname, self.dirname, 'html', filename)
+                        for filename in os.listdir(htmlfiles_dir):
+                            src = os.path.join(htmlfiles_dir, filename)
                             dst = os.path.join(web_output_dir, filename)
                             if not os.path.exists(os.path.split(dst)[0]):
                                 os.makedirs(os.path.split(dst)[0])



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