Skip to content

Commit d6d5c34

Browse files
committed
Add debugging output to show wheel directory structures
Add debugging output to show the directory structure of input and output wheels for troubleshooting. This will help diagnose issues with the wheel merge process. - Use Python's zipfile module (standard library) to list wheel contents - Add debugging output showing cuda/core/ directory structure for: * Each input wheel before merging * The output merged wheel after merging - Format output similar to unzip -l for readability - Filter output to show only cuda/core/ entries
1 parent 2f85310 commit d6d5c34

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

ci/tools/merge_cuda_core_wheels.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import subprocess
2626
import sys
2727
import tempfile
28+
import zipfile
2829
from pathlib import Path
2930
from typing import List
3031

@@ -54,6 +55,31 @@ def merge_wheels(wheels: List[Path], output_dir: Path) -> Path:
5455
if len(wheels) == 1:
5556
raise RuntimeError("only one wheel is provided, nothing to merge")
5657

58+
# Debug: Show directory structure of input wheels
59+
print("\n=== Input wheel directory structures ===", file=sys.stderr)
60+
for i, wheel in enumerate(wheels):
61+
print(f"\n--- Input wheel {i + 1}: {wheel.name} ---", file=sys.stderr)
62+
try:
63+
with zipfile.ZipFile(wheel, "r") as zf:
64+
print(f"{'Length':>10} {'Date':>12} {'Time':>8} Name", file=sys.stderr)
65+
print("-" * 80, file=sys.stderr)
66+
total_size = 0
67+
file_count = 0
68+
for name in sorted(zf.namelist()):
69+
if "cuda/core/" in name:
70+
info = zf.getinfo(name)
71+
total_size += info.file_size
72+
file_count += 1
73+
# Format similar to unzip -l output
74+
date_time = info.date_time
75+
date_str = f"{date_time[0]:04d}-{date_time[1]:02d}-{date_time[2]:02d}"
76+
time_str = f"{date_time[3]:02d}:{date_time[4]:02d}:{date_time[5]:02d}"
77+
print(f"{info.file_size:10d} {date_str} {time_str} {name}", file=sys.stderr)
78+
print("-" * 80, file=sys.stderr)
79+
print(f"{total_size:10d} {file_count} files", file=sys.stderr)
80+
except Exception as e:
81+
print(f"Warning: Could not list wheel contents: {e}", file=sys.stderr)
82+
5783
# Extract all wheels to temporary directories
5884
with tempfile.TemporaryDirectory() as temp_dir:
5985
temp_path = Path(temp_dir)
@@ -157,6 +183,30 @@ def merge_wheels(wheels: List[Path], output_dir: Path) -> Path:
157183

158184
merged_wheel = output_wheels[0]
159185
print(f"Successfully merged wheel: {merged_wheel}", file=sys.stderr)
186+
187+
# Debug: Show directory structure of output wheel
188+
print("\n=== Output wheel directory structure ===", file=sys.stderr)
189+
try:
190+
with zipfile.ZipFile(merged_wheel, "r") as zf:
191+
print(f"{'Length':>10} {'Date':>12} {'Time':>8} Name", file=sys.stderr)
192+
print("-" * 80, file=sys.stderr)
193+
total_size = 0
194+
file_count = 0
195+
for name in sorted(zf.namelist()):
196+
if "cuda/core/" in name:
197+
info = zf.getinfo(name)
198+
total_size += info.file_size
199+
file_count += 1
200+
# Format similar to unzip -l output
201+
date_time = info.date_time
202+
date_str = f"{date_time[0]:04d}-{date_time[1]:02d}-{date_time[2]:02d}"
203+
time_str = f"{date_time[3]:02d}:{date_time[4]:02d}:{date_time[5]:02d}"
204+
print(f"{info.file_size:10d} {date_str} {time_str} {name}", file=sys.stderr)
205+
print("-" * 80, file=sys.stderr)
206+
print(f"{total_size:10d} {file_count} files", file=sys.stderr)
207+
except Exception as e:
208+
print(f"Warning: Could not list wheel contents: {e}", file=sys.stderr)
209+
160210
return merged_wheel
161211

162212

0 commit comments

Comments
 (0)