Skip to content

Commit

Permalink
Try to improve error log on build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
juntyr authored Sep 30, 2024
1 parent 71ee2cf commit 0fbca79
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions patches/pyodide.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7341,10 +7341,24 @@ index 00000000..b43db657
+ summary: Backport of pathlib-compatible object wrapper for zip files
+ license: "MIT"
diff --git a/pyodide-build/pyodide_build/buildall.py b/pyodide-build/pyodide_build/buildall.py
index 177c9406..d41a79a7 100755
index 177c9406..53d4be92 100755
--- a/pyodide-build/pyodide_build/buildall.py
+++ b/pyodide-build/pyodide_build/buildall.py
@@ -175,9 +175,9 @@ class PackageStatus:
@@ -162,7 +162,12 @@ class Package(BasePackage):
logger.error(f"Error building {self.name}. Printing build logs.")
logfile = self.pkgdir / "build.log"
if logfile.is_file():
- logger.error(logfile.read_text(encoding="utf-8"))
+ try:
+ logger.error(logfile.read_text(encoding="utf-8"))
+ except:
+ print("\n" * 10)
+ print(logfile.read_text(encoding="utf-8"))
+ print("\n" * 10)
else:
logger.error("ERROR: No build log found.")
logger.error("ERROR: cancelling buildall")
@@ -175,9 +180,9 @@ class PackageStatus:
) -> None:
self.pkg_name = name
self.prefix = f"[{idx}/{total_packages}] " f"(thread {thread})"
Expand All @@ -7356,15 +7370,15 @@ index 177c9406..d41a79a7 100755
self.finished = False

def finish(self, success: bool, elapsed_time: float) -> None:
@@ -210,6 +210,7 @@ class ReplProgressFormatter:
@@ -210,6 +215,7 @@ class ReplProgressFormatter:
"{task.completed}/{task.total} [progress.percentage]{task.percentage:>3.0f}%",
"Time elapsed:",
TimeElapsedColumn(),
+ auto_refresh=False,
)
self.task = self.progress.add_task("Building packages...", total=num_packages)
self.packages: list[PackageStatus] = []
@@ -610,7 +611,7 @@ def build_from_graph(
@@ -610,7 +616,7 @@ def build_from_graph(
Thread(target=builder, args=(n + 1,), daemon=True).start()

num_built = len(already_built)
Expand All @@ -7373,7 +7387,7 @@ index 177c9406..d41a79a7 100755
while num_built < len(pkg_map):
match built_queue.get():
case BuildError() as err:
@@ -625,6 +626,7 @@ def build_from_graph(
@@ -625,6 +631,7 @@ def build_from_graph(
num_built += 1

progress_formatter.update_progress_bar()
Expand Down

0 comments on commit 0fbca79

Please sign in to comment.