mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-23 04:33:48 +08:00
Merge branch 'refs/heads/ui-sp-split' into master-dev-c3
This commit is contained in:
+4
-44
@@ -7,8 +7,6 @@ import numpy as np
|
||||
|
||||
import SCons.Errors
|
||||
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
|
||||
SCons.Warnings.warningAsException(True)
|
||||
|
||||
# pending upstream fix - https://github.com/SCons/scons/issues/4461
|
||||
@@ -20,44 +18,6 @@ UBUNTU_FOCAL = int(subprocess.check_output('[ -f /etc/os-release ] && . /etc/os-
|
||||
Export('UBUNTU_FOCAL')
|
||||
_DEBUG = False
|
||||
|
||||
def is_internal_developer(debug=False):
|
||||
def collect_required_gpg_key_ids(keys_dir):
|
||||
try:
|
||||
key_ids = [f.split('.')[0] for f in os.listdir(keys_dir) if f.endswith(".gpg")]
|
||||
if debug:
|
||||
print(f"SP: Required GPG key IDs: {key_ids}")
|
||||
return key_ids
|
||||
except OSError as e:
|
||||
if debug:
|
||||
print(f"SP: Failed to read GPG key IDs from {keys_dir}. Error: {e}")
|
||||
return []
|
||||
|
||||
def is_key_available(required_gpg_key_ids):
|
||||
for key_id in required_gpg_key_ids:
|
||||
try:
|
||||
result = subprocess.check_output(['gpg', '--list-keys', key_id], stderr=subprocess.STDOUT)
|
||||
if key_id in result.decode():
|
||||
if debug:
|
||||
print(f"SP: GPG key {key_id} is available.")
|
||||
return True
|
||||
except subprocess.CalledProcessError as e:
|
||||
if debug:
|
||||
print(f"SP: Failed to list GPG key {key_id}. Error:", e.output.decode().strip())
|
||||
return False
|
||||
|
||||
keys_dir = os.path.join(BASEDIR, ".git-crypt/keys/default/0")
|
||||
required_gpg_key_ids = collect_required_gpg_key_ids(keys_dir)
|
||||
|
||||
sunnypilot = is_key_available(required_gpg_key_ids)
|
||||
|
||||
if sunnypilot:
|
||||
print("SP: Confirmed sunnypilot internal developer.")
|
||||
print("SP: Loading sunnypilot elements ...")
|
||||
elif debug:
|
||||
print("SP: None of the required GPG keys are available.")
|
||||
|
||||
return sunnypilot
|
||||
|
||||
Decider('MD5-timestamp')
|
||||
|
||||
SetOption('num_jobs', int(os.cpu_count()/2))
|
||||
@@ -113,11 +73,11 @@ AddOption('--minimal',
|
||||
default=os.path.exists(File('#.lfsconfig').abspath), # minimal by default on release branch (where there's no LFS)
|
||||
help='the minimum build to run openpilot. no tests, tools, etc.')
|
||||
|
||||
AddOption('--sunnypilot',
|
||||
AddOption('--stock-ui',
|
||||
action='store_true',
|
||||
dest='sunnypilot',
|
||||
default=is_internal_developer(_DEBUG) or True, # check if the current user is a sunnypilot developer. TODO: Remove the 'or True' part once the GPG keys are available.
|
||||
help='build sunnypilot elements and other sunnypilot-specific items that are meant for internal development')
|
||||
dest='stock_ui',
|
||||
default=False,
|
||||
help='Build the stock UI instead of sunnypilot UI')
|
||||
|
||||
## Architecture name breakdown (arch)
|
||||
## - larch64: linux tici aarch64
|
||||
|
||||
@@ -21,7 +21,7 @@ sp_widgets_src = []
|
||||
sp_maps_widgets_src = []
|
||||
sp_qt_src = []
|
||||
sp_qt_util = []
|
||||
if GetOption('sunnypilot'):
|
||||
if not GetOption('stock_ui'):
|
||||
SConscript(['sunnypilot/SConscript'])
|
||||
Import('sp_widgets_src', 'sp_maps_widgets_src', 'sp_qt_src', "sp_qt_util")
|
||||
|
||||
@@ -32,7 +32,7 @@ widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/wifi.cc",
|
||||
"qt/widgets/scrollview.cc", "qt/widgets/cameraview.cc", "#third_party/qrcode/QrCode.cc",
|
||||
"qt/request_repeater.cc", "qt/qt_window.cc", "qt/network/networking.cc", "qt/network/wifi_manager.cc"] + sp_widgets_src
|
||||
|
||||
qt_env['CPPDEFINES'] = ["SUNNYPILOT"] if GetOption('sunnypilot') else []
|
||||
qt_env['CPPDEFINES'] = ["SUNNYPILOT"] if not GetOption('stock_ui') else []
|
||||
if maps:
|
||||
base_libs += ['QMapLibre']
|
||||
widgets_src += ["qt/maps/map_helpers.cc", "qt/maps/map_settings.cc", "qt/maps/map.cc", "qt/maps/map_panel.cc",
|
||||
@@ -81,7 +81,7 @@ asset_obj = qt_env.Object("assets", assets)
|
||||
qt_env.SharedLibrary("qt/python_helpers", ["qt/qt_window.cc"], LIBS=qt_libs)
|
||||
|
||||
# spinner and text window
|
||||
text_cc_path = "qt/text.cc" if not GetOption('sunnypilot') else "sunnypilot/qt/text.cc"
|
||||
text_cc_path = "qt/text.cc" if GetOption('stock_ui') else "sunnypilot/qt/text.cc"
|
||||
qt_env.Program("_text", [text_cc_path], LIBS=qt_libs)
|
||||
qt_env.Program("_spinner", ["qt/spinner.cc"], LIBS=qt_libs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user