library-web r511 - in trunk: . data data/xslt src



Author: fpeters
Date: Mon Oct 13 11:37:21 2008
New Revision: 511
URL: http://svn.gnome.org/viewvc/library-web?rev=511&view=rev

Log:
* data/catalog.xml.in, data/xslt/indexes.xsl, src/config.py,
src/defaults.lgorc, src/lgo.py: added support for publishing
documentation from nightly tarballs.



Modified:
   trunk/ChangeLog
   trunk/data/catalog.xml.in
   trunk/data/xslt/indexes.xsl
   trunk/src/config.py
   trunk/src/defaults.lgorc
   trunk/src/lgo.py

Modified: trunk/data/catalog.xml.in
==============================================================================
--- trunk/data/catalog.xml.in	(original)
+++ trunk/data/catalog.xml.in	Mon Oct 13 11:37:21 2008
@@ -79,4 +79,5 @@
   <_msgstr msgid="allinonepage">
     Same documents, formatted as a single HTML file
   </_msgstr>
+  <_msgstr msgid="nightly-version">Nightly</_msgstr>
 </msgcat>

Modified: trunk/data/xslt/indexes.xsl
==============================================================================
--- trunk/data/xslt/indexes.xsl	(original)
+++ trunk/data/xslt/indexes.xsl	Mon Oct 13 11:37:21 2008
@@ -303,7 +303,9 @@
 	      <ul class="versions">
 	      <xsl:for-each select="versions/version">
 	        <li>
-		 <a href="{ href}/" lang="{ lang}"><xsl:value-of select="."/></a>
+		 <a href="{ href}/" lang="{ lang}"><xsl:apply-templates
+		 	select="." mode="version-name"><xsl:with-param name="lang" select="$lang"/>
+			</xsl:apply-templates></a>
 		 <xsl:if test="@keyword = 'unstable'">
 		    (<xsl:call-template name="gettext"><xsl:with-param name="lang"
 		      select="$lang"/><xsl:with-param name="msgid"
@@ -320,7 +322,9 @@
 	      <ul class="versions">
 	      <xsl:for-each select="versions/version">
 	        <li>
-		 <a href="{ href}/{$modulename}.html" lang="{ lang}"><xsl:value-of select="."/></a>
+		 <a href="{ href}/{$modulename}.html" lang="{ lang}"><xsl:apply-templates
+		 	select="." mode="version-name"><xsl:with-param name="lang" select="$lang"/>
+			</xsl:apply-templates></a>
 		 <xsl:if test="@keyword = 'unstable'">
 		    (<xsl:call-template name="gettext"><xsl:with-param name="lang"
 		      select="$lang"/><xsl:with-param name="msgid"
@@ -391,6 +395,20 @@
     </xsl:if>
   </xsl:template>
 
+  <xsl:template match="version" mode="version-name">
+    <xsl:param name="lang"/>
+    <xsl:choose>
+      <xsl:when test=". = 'nightly'">
+        <xsl:call-template name="gettext"><xsl:with-param name="lang"
+          select="$lang"/><xsl:with-param name="msgid"
+	  select="'nightly-version'"/></xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="."/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <xsl:template match="section" mode="channelindex">
     <xsl:param name="lang"/>
     <xsl:param name="hidetitle" value="false()"/>

Modified: trunk/src/config.py
==============================================================================
--- trunk/src/config.py	(original)
+++ trunk/src/config.py	Mon Oct 13 11:37:21 2008
@@ -31,7 +31,7 @@
             'version_min', 'version_max', 'modules', 'languages',
             'blacklist', 'extra_tarballs', 'symbols_dbm_filepath',
             'httxt2dbm_path', 'fast_mode', 'create_tarballs',
-            'symbols_sqlite_filepath']
+            'symbols_sqlite_filepath', 'nightly_tarballs_location']
 
 class Config:
     def __init__(self, filename=_default_lgorc):

Modified: trunk/src/defaults.lgorc
==============================================================================
--- trunk/src/defaults.lgorc	(original)
+++ trunk/src/defaults.lgorc	Mon Oct 13 11:37:21 2008
@@ -55,3 +55,5 @@
 # also create tarballs with HTML files for download
 create_tarballs = True
 
+# location of nightly tarballs
+nightly_tarballs_location = None

Modified: trunk/src/lgo.py
==============================================================================
--- trunk/src/lgo.py	(original)
+++ trunk/src/lgo.py	Mon Oct 13 11:37:21 2008
@@ -363,7 +363,9 @@
     related_xsl_files = None
     mtime_xslt_files = 0
 
-    def __init__(self, tar, tarinfo, makefile_am):
+    nightly = False
+
+    def __init__(self, tar, tarinfo, makefile_am, nightly = False):
         self.dirname = os.path.dirname(tarinfo.name)
         if makefile_am:
             self.makefile_am = makefile_am
@@ -374,10 +376,15 @@
                 # lays madness, instead simply cut out the variable, such as
                 # gnome-scan- API_VERSION@ becomes gnome-scan.
                 self.modulename = self.modulename.split('@')[0].strip('-')
-        self.version = os.path.splitext(tar.name)[0].split('-')[-1]
-        if self.version.endswith('.tar'):
-            self.version = self.version[:-4]
-        self.one_dot_version = re.match(r'\d+\.\d+', self.version).group()
+        if nightly:
+            self.nightly = True
+            self.version = 'nightly'
+            self.one_dot_version = 'nightly'
+        else:
+            self.version = os.path.splitext(tar.name)[0].split('-')[-1]
+            if self.version.endswith('.tar'):
+                self.version = self.version[:-4]
+            self.one_dot_version = re.match(r'\d+\.\d+', self.version).group()
 
         if self.related_xsl_files:
             self.mtime_xslt_files = max([os.stat(
@@ -434,16 +441,17 @@
                 # file was already processed in a previous moduleset
                 return None
 
-            # a more recent version may already have been installed; probably
-            # because the same module is being mentioned as an extra tarball
-            # with an inferior version number; don't update path in this
-            # situation.  (see bug #530517 for the mention of this problem)
-            if version_cmp(doc._last_version, self.version) <= 0:
-                doc._last_version = self.version
-                if int(self.one_dot_version.split('.')[1]) % 2 == 0:
-                    # update path to point to the latest version (but no
-                    # development versions)
-                    doc.path = self.path
+            if not self.nightly:
+                # a more recent version may already have been installed; probably
+                # because the same module is being mentioned as an extra tarball
+                # with an inferior version number; don't update path in this
+                # situation.  (see bug #530517 for the mention of this problem)
+                if version_cmp(doc._last_version, self.version) <= 0:
+                    doc._last_version = self.version
+                    if int(self.one_dot_version.split('.')[1]) % 2 == 0:
+                        # update path to point to the latest version (but no
+                        # development versions)
+                        doc.path = self.path
 
             if not self.one_dot_version in doc.versions:
                 doc.versions.append(self.one_dot_version)
@@ -464,6 +472,9 @@
     def install_version_symlinks(self, doc):
         '''Create stable and devel symlinks'''
 
+        if self.nightly:
+            return
+
         if self.channel not in ('users', 'devel', 'admin'):
             return
 
@@ -724,8 +735,8 @@
 
     related_xsl_files = ['db2html.xsl', 'heading.xsl']
 
-    def __init__(self, tar, tarinfo, makefile_am):
-        DocModule.__init__(self, tar, tarinfo, makefile_am)
+    def __init__(self, tar, tarinfo, makefile_am, nightly):
+        DocModule.__init__(self, tar, tarinfo, makefile_am, nightly)
         if self.modulename == '@PACKAGE_NAME@':
             # ekiga has this, use another way, looking at omf files
             try:
@@ -1088,7 +1099,7 @@
     related_xsl_files = ['html2html.xsl', 'heading.xsl']
 
     def __init__(self, tar, tarinfo, tarball_doc_elem):
-        DocModule.__init__(self, tar, tarinfo, None)
+        DocModule.__init__(self, tar, tarinfo, None, False)
         self.tarball_doc_elem = tarball_doc_elem
         self.modulename = self.tarball_doc_elem.attrib.get('doc_module')
         if self.tarball_doc_elem.find('transform-mode') is not None:
@@ -1447,6 +1458,8 @@
         self.process_releases()
         if not self.options.skip_extra_tarballs:
             self.process_extra_tarballs()
+        if self.config.nightly_tarballs_location:
+            self.process_nightly_tarballs()
         self.apply_overlay()
         self.generate_indexes()
         self.generate_symbols_files()
@@ -1697,7 +1710,7 @@
             extra_tarball = 'gnome://%s?min=%s' % (tarball.attrib['id'], min_version)
             self.config.extra_tarballs.append(extra_tarball)
 
-    def extract_modules(self, filename):
+    def extract_modules(self, filename, nightly = False):
         logging.debug('looking for doc modules in %s' % filename)
         doc_modules = []
 
@@ -1711,6 +1724,8 @@
             stamp_file = None
 
         base_tarball_name = os.path.basename(filename).rsplit('-', 1)[0]
+        if nightly:
+            stamp_file = None
 
         if stamp_file and os.path.exists(stamp_file) and not os.path.exists(ext_dirname):
             # file was extracted once, and no doc module were found inside
@@ -1742,16 +1757,16 @@
                 makefile_am = makefile_am.replace('\\\n', ' ')
                 if 'DOC_MODULE' in makefile_am and regex_gdu.findall(makefile_am):
                     logging.debug('found usage of gnome-doc-utils in %s' % tarinfo.name)
-                    doc = GnomeDocUtilsModule(tar, tarinfo, makefile_am)
+                    doc = GnomeDocUtilsModule(tar, tarinfo, makefile_am, nightly)
                 elif 'include $(top_srcdir)/gtk-doc.make' in makefile_am or \
                         ('gtkdoc-scan' in makefile_am and not 'gtk-doc' in tarinfo.name):
                     logging.debug('found usage of gtk-doc in %s' % tarinfo.name)
-                    doc = GtkDocModule(tar, tarinfo, makefile_am)
+                    doc = GtkDocModule(tar, tarinfo, makefile_am, nightly)
                 elif 'SUBDIRS = C' in makefile_am and \
                         os.path.basename(filename).startswith('gtk-doc-'):
                     logging.debug('found gtk-doc almost gnome-doc-utils manual in %s' % tarinfo.name)
                     makefile_am += '\nDOC_MODULE = gtk-doc-manual\n'
-                    doc = GnomeDocUtilsModule(tar, tarinfo, makefile_am)
+                    doc = GnomeDocUtilsModule(tar, tarinfo, makefile_am, nightly)
                 else:
                     continue
 
@@ -1797,6 +1812,16 @@
                     for doc_module in self.extract_modules(fname):
                         doc_module.process()
 
+    def process_nightly_tarballs(self):
+        logging.info('processing nightly tarballs')
+        for filename in os.listdir(self.config.nightly_tarballs_location):
+            if not (filename.endswith('.tar.gz') or filename.endswith('.tar.bz2')):
+                continue
+            filename = os.path.join(self.config.nightly_tarballs_location, filename)
+            for doc_module in self.extract_modules(filename, nightly = True):
+                doc_module.process()
+
+
     def apply_overlay(self):
         logging.info('Applying overlay')
         for doc in self.documents:



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