Verify wheel can be read and contains expected structure.
(wheel_path: str)
| 153 | |
| 154 | |
| 155 | def _verify_wheel_readable(wheel_path: str) -> bool: |
| 156 | """Verify wheel can be read and contains expected structure.""" |
| 157 | print(f" Checking wheel readability: {os.path.basename(wheel_path)}") |
| 158 | |
| 159 | try: |
| 160 | with zipfile.ZipFile(wheel_path, "r") as whl: |
| 161 | file_list = whl.namelist() |
| 162 | |
| 163 | if len(file_list) == 0: |
| 164 | print(" ✗ Wheel is empty (no files)") |
| 165 | return False |
| 166 | |
| 167 | # Check for metadata |
| 168 | metadata_files = [f for f in file_list if "METADATA" in f or "WHEEL" in f] |
| 169 | if not metadata_files: |
| 170 | print(" ✗ Wheel missing required metadata files") |
| 171 | return False |
| 172 | |
| 173 | print(f" ✓ Wheel is readable and contains {len(file_list)} files") |
| 174 | return True |
| 175 | except zipfile.BadZipFile: |
| 176 | print(" ✗ Wheel is corrupted or not a valid ZIP file") |
| 177 | return False |
| 178 | except Exception as e: |
| 179 | print(f" ✗ Error reading wheel: {e}") |
| 180 | return False |
| 181 | |
| 182 | |
| 183 | def _verify_artifact_exists(artifact_path: str, min_size: int = 1000) -> bool: |