From 5fdeb3b3b4dd113c712e7c36fdda3a0f42f8c124 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Feb 2021 13:07:45 +0530 Subject: [PATCH] Use a temp dir as cache dir when running tests during freezing on linux --- bypy/linux/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bypy/linux/__main__.py b/bypy/linux/__main__.py index 44854ec71..fc34c7884 100644 --- a/bypy/linux/__main__.py +++ b/bypy/linux/__main__.py @@ -8,6 +8,7 @@ import shutil import stat import subprocess import tarfile +import tempfile import time from bypy.constants import ( @@ -194,7 +195,12 @@ def main(): ext_dir = globals()['ext_dir'] if not args.skip_tests: run_tests = iv['run_tests'] - run_tests(None, os.path.join(ext_dir, 'src')) + with tempfile.TemporaryDirectory() as tdir: + os.environ['KITTY_CACHE_DIRECTORY'] = tdir + try: + run_tests(None, os.path.join(ext_dir, 'src')) + finally: + del os.environ['KITTY_CACHE_DIRECTORY'] env = Env(os.path.join(ext_dir, kitty_constants['appname'])) copy_libs(env) copy_python(env)