From 9265919881b34f0ccdfac2f7835db99c21d09c2a Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 17 Aug 2023 10:30:55 -0700 Subject: [PATCH] SCons: respect cache read only (#29437) * respect readonly * gitignore and move to correct folder * also copy old old-commit-hash: 59abb469ea4a8443ea07a0638acbc6ece0c9ddd2 --- .gitignore | 1 + SConstruct | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 85c196aea8..8744237584 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ venv/ .tags .ipynb_checkpoints .idea +.moc_files .overlay_init .overlay_consistent .sconsign.dblite diff --git a/SConstruct b/SConstruct index 3d75dccf9b..e384e31d94 100644 --- a/SConstruct +++ b/SConstruct @@ -1,4 +1,5 @@ import os +import shutil import subprocess import sys import sysconfig @@ -334,7 +335,18 @@ qt_flags = [ qt_env['CXXFLAGS'] += qt_flags qt_env['LIBPATH'] += ['#selfdrive/ui'] qt_env['LIBS'] = qt_libs -qt_env['QT3_MOCHPREFIX'] = cache_dir + '/moc_files/moc_' + +# Have to respect cache-readonly +if GetOption('cache_readonly'): + local_moc_files_dir = Dir("#.moc_files").abspath + cache_moc_files_dir = cache_dir + "/moc_files" + if os.path.exists(local_moc_files_dir): + shutil.rmtree(local_moc_files_dir) + if os.path.exists(cache_moc_files_dir): + shutil.copytree(cache_moc_files_dir, local_moc_files_dir) + qt_env['QT3_MOCHPREFIX'] = local_moc_files_dir + "/moc_" +else: + qt_env['QT3_MOCHPREFIX'] = cache_dir + '/moc_files/moc_' if GetOption("clazy"): checks = [