pythonparsecache = {}
shellparsecache = {}
+pythonparsecacheextras = {}
+shellparsecacheextras = {}
+
def parser_cachefile(d):
cachedir = (d.getVar("PERSISTENT_DIR", True) or
i = i + 1
continue
- try:
- p = pickle.Unpickler(file(cachefile, "rb"))
- data, version = p.load()
- except (IOError, EOFError, ValueError):
- data, version = None, None
-
- if version != PARSERCACHE_VERSION:
- shellcache = shellparsecache
- pythoncache = pythonparsecache
- else:
- for h in pythonparsecache:
- if h not in data[0]:
- pythoncache[h] = pythonparsecache[h]
- for h in shellparsecache:
- if h not in data[1]:
- shellcache[h] = shellparsecache[h]
+ shellcache = shellparsecacheextras
+ pythoncache = pythonparsecacheextras
p = pickle.Pickler(file(cachefile + "-" + str(i), "wb"), -1)
p.dump([[pythoncache, shellcache], PARSERCACHE_VERSION])
self.execs = pythonparsecache[h]["execs"]
return
+ if h in pythonparsecacheextras:
+ self.references = pythonparsecacheextras[h]["refs"]
+ self.execs = pythonparsecacheextras[h]["execs"]
+ return
+
+
code = compile(check_indent(str(node)), "<string>", "exec",
ast.PyCF_ONLY_AST)
self.references.update(self.var_references)
self.references.update(self.var_execs)
- pythonparsecache[h] = {}
- pythonparsecache[h]["refs"] = self.references
- pythonparsecache[h]["execs"] = self.execs
+ pythonparsecacheextras[h] = {}
+ pythonparsecacheextras[h]["refs"] = self.references
+ pythonparsecacheextras[h]["execs"] = self.execs
class ShellParser():
def __init__(self, name, log):
self.execs = shellparsecache[h]["execs"]
return self.execs
+ if h in shellparsecacheextras:
+ self.execs = shellparsecacheextras[h]["execs"]
+ return self.execs
+
try:
tokens, _ = pyshyacc.parse(value, eof=True, debug=False)
except pyshlex.NeedMore:
self.process_tokens(token)
self.execs = set(cmd for cmd in self.allexecs if cmd not in self.funcdefs)
- shellparsecache[h] = {}
- shellparsecache[h]["execs"] = self.execs
+ shellparsecacheextras[h] = {}
+ shellparsecacheextras[h]["execs"] = self.execs
return self.execs