|
15 | 15 | from basilisp.lang.util import demunge
|
16 | 16 | from basilisp.util import timed
|
17 | 17 |
|
| 18 | +_NO_CACHE_ENVVAR = 'BASILISP_DO_NOT_CACHE_NAMESPACES' |
| 19 | + |
18 | 20 | MAGIC_NUMBER = (1149).to_bytes(2, 'little') + b'\r\n'
|
19 | 21 |
|
20 | 22 | logger = logging.getLogger(__name__)
|
@@ -227,11 +229,14 @@ def exec_module(self, module):
|
227 | 229 |
|
228 | 230 | # Check if a valid, cached version of this Basilisp namespace exists and, if so,
|
229 | 231 | # load it and bypass the expensive compilation process below.
|
230 |
| - try: |
231 |
| - self._exec_cached_module(fullname, spec.loader_state, path_stats, module) |
232 |
| - except (EOFError, ImportError, IOError, OSError) as e: |
233 |
| - logger.debug(f"Failed to load cached Basilisp module: {e}") |
| 232 | + if os.getenv(_NO_CACHE_ENVVAR, None) == 'True': |
234 | 233 | self._exec_module(fullname, spec.loader_state, path_stats, module)
|
| 234 | + else: |
| 235 | + try: |
| 236 | + self._exec_cached_module(fullname, spec.loader_state, path_stats, module) |
| 237 | + except (EOFError, ImportError, IOError, OSError) as e: |
| 238 | + logger.debug(f"Failed to load cached Basilisp module: {e}") |
| 239 | + self._exec_module(fullname, spec.loader_state, path_stats, module) |
235 | 240 |
|
236 | 241 | # Because we want to (by default) add 'basilisp.core into every namespace by default,
|
237 | 242 | # we want to make sure we don't try to add 'basilisp.core into itself, causing a
|
|
0 commit comments