SCons: respect cache read only (#29437)

* respect readonly

* gitignore and move to correct folder

* also copy old
This commit is contained in:
Justin Newberry
2023-08-17 10:30:55 -07:00
committed by GitHub
parent ad32816fd6
commit 59abb469ea
2 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@ venv/
.tags
.ipynb_checkpoints
.idea
.moc_files
.overlay_init
.overlay_consistent
.sconsign.dblite

View File

@@ -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 = [