library-web r396 - in trunk: . src



Author: fpeters
Date: Sun Mar  2 12:19:18 2008
New Revision: 396
URL: http://svn.gnome.org/viewvc/library-web?rev=396&view=rev

Log:
* src/config.py, src/defaults.lgorc, src/lgo.py: removed
always_extract_and_rebuild configuration option, added check on mtime
on tarballs so a changed tarball triggers a rebuild instead.



Modified:
   trunk/ChangeLog
   trunk/src/config.py
   trunk/src/defaults.lgorc
   trunk/src/lgo.py

Modified: trunk/src/config.py
==============================================================================
--- trunk/src/config.py	(original)
+++ trunk/src/config.py	Sun Mar  2 12:19:18 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', 'always_extract_and_rebuild']
+            'symbols_sqlite_filepath']
 
 class Config:
     def __init__(self, filename=_default_lgorc):

Modified: trunk/src/defaults.lgorc
==============================================================================
--- trunk/src/defaults.lgorc	(original)
+++ trunk/src/defaults.lgorc	Sun Mar  2 12:19:18 2008
@@ -55,5 +55,3 @@
 # also create tarballs with HTML files for download
 create_tarballs = True
 
-# list of tarballs to always rebuild
-always_extract_and_rebuild = ['release-notes']

Modified: trunk/src/lgo.py
==============================================================================
--- trunk/src/lgo.py	(original)
+++ trunk/src/lgo.py	Sun Mar  2 12:19:18 2008
@@ -374,21 +374,14 @@
             os.makedirs(ext_dirname)
 
         base_tarball_name = os.path.basename(self.filename).rsplit('-', 1)[0]
-        if base_tarball_name in app.config.always_extract_and_rebuild or \
-                os.path.basename(self.filename) in app.config.always_extract_and_rebuild:
-            always_extract = True
-        else:
-            always_extract = False
 
-        if always_extract or not os.path.exists(os.path.join(ext_dirname, self.dirname)):
+        if not os.path.exists(os.path.join(ext_dirname, self.dirname)):
             logging.debug('extracting %s' % self.dirname)
             tar = tarfile.open(self.filename, 'r')
             for tarinfo in tar.getmembers():
                 if not os.path.split(tarinfo.name)[0].startswith(self.dirname):
                     continue
                 dest = os.path.join(ext_dirname, tarinfo.name)
-                if os.path.exists(dest) and not always_extract:
-                    continue
                 if tarinfo.isdir() and not os.path.exists(dest):
                     os.makedirs(dest)
                 elif tarinfo.isreg():
@@ -791,11 +784,6 @@
                     self.modulename, tarball_name)
 
         base_tarball_name = os.path.basename(self.filename).rsplit('-', 1)[0]
-        if base_tarball_name in app.config.always_extract_and_rebuild or \
-                os.path.basename(self.filename) in app.config.always_extract_and_rebuild:
-            always_rebuild = True
-        else:
-            always_rebuild = False
 
         for lang in doc.languages:
             if lang == 'en' and not os.path.exists(os.path.join(ext_dirname, self.dirname, 'en')):
@@ -811,7 +799,7 @@
 
             xml_index_file = os.path.join(web_output_dir, 'index.xml.%s' % lang)
             skip_html_files = False
-            if not app.rebuild_all and not always_rebuild and (
+            if not app.rebuild_all and (
                     app.rebuild_language is None or
                     lang != app.rebuild_language) and os.path.exists(xml_index_file):
                 mtime = os.stat(xml_index_file)[stat.ST_MTIME]
@@ -858,6 +846,9 @@
                     cmd.insert(5, '--stringparam')
                     cmd.insert(6, 'db.chunk.max_depth')
                     cmd.insert(7, '0')
+                    cmd.insert(5, '--stringparam')
+                    cmd.insert(6, 'db.chunk.autotoc_depth')
+                    cmd.insert(7, '1')
                 if 'languages-in-sidebar' in quirks:
                     cmd.insert(5, '--stringparam')
                     cmd.insert(6, 'libgo.languages_in_sidebar')
@@ -1652,13 +1643,17 @@
             stamp_file = None
 
         base_tarball_name = os.path.basename(filename).rsplit('-', 1)[0]
-        if base_tarball_name in self.config.always_extract_and_rebuild or \
-                os.path.basename(filename) in self.config.always_extract_and_rebuild:
-            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
             return []
+        elif stamp_file and os.path.exists(stamp_file) and os.stat(stamp_file)[stat.ST_MTIME] < mtime:
+            # file was extracted but has been modified since then, remove
+            # extraction if it exists:
+            if os.path.exists(ext_dirname):
+                logging.debug('removing old copy of files from %s' % base_tarball_name)
+                shutil.rmtree(ext_dirname, ignore_errors = True)
+            tar = tarfile.open(filename, 'r')
         elif stamp_file and os.path.exists(stamp_file):
             tar = utils.FakeTarFile(ext_dirname)
         else:



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