From 3620633b2aeb0c24a2a5624fce46587f6baded1a Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Thu, 23 May 2013 21:56:43 +0200 Subject: [PATCH] Turn off FS cache in sith.py by default --- sith.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sith.py b/sith.py index 34c70bea..ca1e1804 100755 --- a/sith.py +++ b/sith.py @@ -28,6 +28,8 @@ import traceback import jedi +_unspecified = object() + class SourceCode(object): @@ -236,7 +238,12 @@ class AttackApp(object): parser = self.get_parser() self.do_run(**vars(parser.parse_args(args))) - def do_run(self, func, debugger, **kwds): + def do_run(self, func, debugger, fs_cache, **kwds): + if fs_cache is _unspecified: + jedi.settings.use_filesystem_cache = False + else: + jedi.settings.cache_directory = fs_cache + try: func(**kwds) except: @@ -274,6 +281,13 @@ class AttackApp(object): parser.add_argument( '--ipdb', dest='debugger', const='ipdb', action='store_const', help='Launch ipdb when error is raised.') + parser.add_argument( + '--fs-cache', '-C', default=_unspecified, + help=""" + By default, file system cache is off for reproducibility. + Pass a temporary directory to use file system cache. + It is set to ``jedi.settings.cache_directory``. + """) self.subparsers = parser.add_subparsers() self.add_parser(RandomAttacker, 'random')