Commit ce9b4f5c authored by Robert Bradshaw's avatar Robert Bradshaw

Cleanup cache option.

parent 0fe4f394
...@@ -862,7 +862,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False, ...@@ -862,7 +862,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
print("Compiling %s because it changed." % source) print("Compiling %s because it changed." % source)
else: else:
print("Compiling %s because it depends on %s." % (source, dep)) print("Compiling %s because it depends on %s." % (source, dep))
if not force and hasattr(options, 'cache'): if not force and options.cache:
extra = m.language extra = m.language
fingerprint = deps.transitive_fingerprint(source, extra) fingerprint = deps.transitive_fingerprint(source, extra)
else: else:
...@@ -880,7 +880,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False, ...@@ -880,7 +880,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
copy_to_build_dir(source) copy_to_build_dir(source)
m.sources = new_sources m.sources = new_sources
if hasattr(options, 'cache'): if options.cache:
if not os.path.exists(options.cache): if not os.path.exists(options.cache):
os.makedirs(options.cache) os.makedirs(options.cache)
to_compile.sort() to_compile.sort()
...@@ -943,7 +943,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False, ...@@ -943,7 +943,7 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
print("Failed compilations: %s" % ', '.join(sorted([ print("Failed compilations: %s" % ', '.join(sorted([
module.name for module in failed_modules]))) module.name for module in failed_modules])))
if hasattr(options, 'cache'): if options.cache:
cleanup_cache(options.cache, getattr(options, 'cache_size', 1024 * 1024 * 100)) cleanup_cache(options.cache, getattr(options, 'cache_size', 1024 * 1024 * 100))
# cythonize() is often followed by the (non-Python-buffered) # cythonize() is often followed by the (non-Python-buffered)
# compiler output, flush now to avoid interleaving output. # compiler output, flush now to avoid interleaving output.
......
...@@ -567,11 +567,8 @@ class CompilationOptions(object): ...@@ -567,11 +567,8 @@ class CompilationOptions(object):
options['language_level'] = int(directives['language_level']) options['language_level'] = int(directives['language_level'])
if 'formal_grammar' in directives and 'formal_grammar' not in kw: if 'formal_grammar' in directives and 'formal_grammar' not in kw:
options['formal_grammar'] = directives['formal_grammar'] options['formal_grammar'] = directives['formal_grammar']
if 'cache' in options:
if options['cache'] is True: if options['cache'] is True:
options['cache'] = os.path.expanduser("~/.cycache") options['cache'] = os.path.expanduser("~/.cycache")
elif options['cache'] in (False, None):
del options['cache']
self.__dict__.update(options) self.__dict__.update(options)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment