From c1457823a0f713e5a81dd899868e10d5af1a4c5b Mon Sep 17 00:00:00 2001 From: Erik Staab Date: Mon, 26 Aug 2024 23:13:11 +0000 Subject: [PATCH] Don't write pyc files if running from Cog Many tools use vpython so we can avoid pyc writes by disabling them at this layer. Bug: b/320565954 Change-Id: I50cd04968810ecc186d5abe6c67e54ae1647c739 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5812665 Commit-Queue: Erik Staab Reviewed-by: Josip Sokcevic --- vpython3 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vpython3 b/vpython3 index 2eb4092d77..e6a5bc7603 100755 --- a/vpython3 +++ b/vpython3 @@ -37,6 +37,11 @@ fi export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "$0")}" export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" +# Don't write pyc files if running from a Cog workspace. +if [[ "$(pwd)" == "/google/cog/"* ]]; then + export PYTHONDONTWRITEBYTECODE=1 +fi + source "${DEPOT_TOOLS_DIR}/cipd_bin_setup.sh" CIPD_ROOT=$(cipd_bin_setup) &> /dev/null