mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-18 08:22:05 +08:00
fix build warnings (#38025)
This commit is contained in:
+23
-22
@@ -11,7 +11,6 @@ from openpilot.system.hardware import HARDWARE, AGNOS
|
||||
def build() -> None:
|
||||
spinner = Spinner()
|
||||
spinner.update_progress(0, 100)
|
||||
env = os.environ.copy()
|
||||
|
||||
HARDWARE.set_power_save(False)
|
||||
if AGNOS:
|
||||
@@ -21,35 +20,37 @@ def build() -> None:
|
||||
compile_output: list[bytes] = []
|
||||
for parallelism in ([], ["-j4"], ["-j1"]):
|
||||
compile_output.clear()
|
||||
scons: subprocess.Popen = subprocess.Popen(["scons", *parallelism], cwd=BASEDIR, env=env, stderr=subprocess.PIPE)
|
||||
assert scons.stderr is not None
|
||||
with subprocess.Popen(["scons", *parallelism], cwd=BASEDIR, env={**os.environ, "PWD": BASEDIR}, stderr=subprocess.PIPE) as scons:
|
||||
assert scons.stderr is not None
|
||||
|
||||
# Read progress from stderr and update spinner
|
||||
while scons.poll() is None:
|
||||
try:
|
||||
line = scons.stderr.readline()
|
||||
if line is None:
|
||||
continue
|
||||
# Read progress from stderr and update spinner
|
||||
while scons.poll() is None:
|
||||
try:
|
||||
line = scons.stderr.readline()
|
||||
if line is None:
|
||||
continue
|
||||
line = line.rstrip()
|
||||
|
||||
prefix = b'progress: '
|
||||
if line.startswith(prefix):
|
||||
progress = float(line[len(prefix):])
|
||||
spinner.update_progress(100 * min(1., progress / 100.), 100.)
|
||||
elif len(line):
|
||||
compile_output.append(line)
|
||||
print(line.decode('utf8', 'replace'))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Drain and close the pipe before retrying or returning.
|
||||
for line in scons.stderr.read().split(b'\n'):
|
||||
line = line.rstrip()
|
||||
|
||||
prefix = b'progress: '
|
||||
if line.startswith(prefix):
|
||||
progress = float(line[len(prefix):])
|
||||
spinner.update_progress(100 * min(1., progress / 100.), 100.)
|
||||
elif len(line):
|
||||
if len(line):
|
||||
compile_output.append(line)
|
||||
print(line.decode('utf8', 'replace'))
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if scons.returncode == 0:
|
||||
break
|
||||
|
||||
if scons.returncode != 0:
|
||||
# Read remaining output
|
||||
if scons.stderr is not None:
|
||||
compile_output += scons.stderr.read().split(b'\n')
|
||||
|
||||
# Build failed log errors
|
||||
error_s = b"\n".join(compile_output).decode('utf8', 'replace')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user