[jhbuild/release-team-commands] new cache option to goalreport



commit b5d9b68c6c0777fbf2af464f9c8b1149a5f8b58a
Author: Frederic Peters <fpeters 0d be>
Date:   Mon May 4 11:36:40 2009 +0200

    new cache option to goalreport
---
 jhbuild/commands/goalreport.py    |   11 ++++++-----
 jhbuild/commands/twoninetynine.py |    3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/jhbuild/commands/goalreport.py b/jhbuild/commands/goalreport.py
index 728b614..0426a3e 100644
--- a/jhbuild/commands/goalreport.py
+++ b/jhbuild/commands/goalreport.py
@@ -253,8 +253,8 @@ class cmd_goalreport(Command):
                     action='store', dest='falsepositivesfile', default=None),
             make_option('--devhelp-dirname', metavar='DIR',
                     action='store', dest='devhelp_dirname', default=None),
-            make_option('--no-cache',
-                    action='store_true', dest='nocache', default=False),
+            make_option('--cache', metavar='FILE',
+                    action='store', dest='cache', default=None),
             make_option('--all-modules',
                         action='store_true', dest='list_all_modules', default=False),
             make_option('--check', metavar='CHECK',
@@ -303,9 +303,9 @@ class cmd_goalreport(Command):
             cachedir = os.path.join(os.environ['XDG_CACHE_HOME'], 'jhbuild')
         except KeyError:
             cachedir = os.path.join(os.environ['HOME'], '.cache','jhbuild')
-        if not options.nocache:
+        if options.cache:
             try:
-                results = cPickle.load(file(os.path.join(cachedir, 'twoninetynine.pck')))
+                results = cPickle.load(file(os.path.join(cachedir, options.cache)))
             except:
                 pass
 
@@ -362,7 +362,8 @@ class cmd_goalreport(Command):
 
         if not os.path.exists(cachedir):
             os.makedirs(cachedir)
-        cPickle.dump(results, file(os.path.join(cachedir, 'twoninetynine.pck'), 'w'))
+        if options.cache:
+            cPickle.dump(results, file(os.path.join(cachedir, options.cache), 'w'))
 
         print >> output, HTML_AT_TOP % {'title': self.title}
         if self.page_intro:
diff --git a/jhbuild/commands/twoninetynine.py b/jhbuild/commands/twoninetynine.py
index fd08fc4..4f8f3c5 100644
--- a/jhbuild/commands/twoninetynine.py
+++ b/jhbuild/commands/twoninetynine.py
@@ -186,6 +186,9 @@ relative to the number of deprecated symbols in use (&lt;5/&lt;20/&gt;=20).
             ])
 
     def run(self, config, options, args):
+        options.cache = 'twoninetynine.pck'
+        if options.nocache:
+            options.cache = None
         options.bugfile = 'http://live.gnome.org/FredericPeters/Bugs299?action=raw'
         options.falsepositivesfile = 'http://live.gnome.org/FredericPeters/FalsePositives299?action=raw'
         return cmd_goalreport.run(self, config, options, args)



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