From 96d5a2c9b9999446c03082c411e7df6ffa5732be Mon Sep 17 00:00:00 2001 From: "Worker Pants (Pantsbuild GitHub Automation Bot)" <133242086+WorkerPants@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:23:46 -0500 Subject: [PATCH] Fix mypy cache dir not being created (Cherry-pick of #20139) (#20142) This PR fixes an issue/bug mentioned in #19888. **Problem** Internal mypy cache directory/folder used by Pants is not being created. Therefore, the mypy cache cannot moved copied from temporary cache location [here](https://github.com/pantsbuild/pants/blob/d5ffed441396d89a2a7bc52fc994c52a00808f8a/src/python/pants/backend/python/typecheck/mypy/rules.py#L306) **Solution** Make sure the mypy cache directory/folder is created. Co-authored-by: csqzhang Co-authored-by: Josh Cannon --- src/python/pants/backend/python/typecheck/mypy/rules.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/python/pants/backend/python/typecheck/mypy/rules.py b/src/python/pants/backend/python/typecheck/mypy/rules.py index c2108360140..0e35929cfc3 100644 --- a/src/python/pants/backend/python/typecheck/mypy/rules.py +++ b/src/python/pants/backend/python/typecheck/mypy/rules.py @@ -294,6 +294,7 @@ async def mypy_typecheck_partition( SANDBOX_CACHE_DIR="{run_cache_dir}/{py_version}" SANDBOX_CACHE_DB="$SANDBOX_CACHE_DIR/cache.db" + {mkdir.path} -p "$NAMED_CACHE_DIR" > /dev/null 2>&1 {mkdir.path} -p "$SANDBOX_CACHE_DIR" > /dev/null 2>&1 {cp.path} "$NAMED_CACHE_DB" "$SANDBOX_CACHE_DB" > /dev/null 2>&1