Commit a6bcfcb
authored
Fix rendering of injected retained-wheel links (#8533)
Follow-up to #8532, which is live on the nightly index:
https://download.pytorch.org/whl/nightly/nvidia-cudnn-cu12/
Two rendering defects in the injected link:
1. **Missing separator.** `pypi.nvidia.com` does not terminate its final
anchor with a `<br>`, so the injected link rendered on the same line as
the last upstream wheel:
```
nvidia_cudnn_cu12-9.9.0.52-py3-none-win_amd64.whl
nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl
```
Fixed by appending the missing `<br/>` after the final upstream `</a>`
before injecting, only when one is not already there.
2. **Wrong indentation.** The block was spliced in with
`html.replace("</body>", ...)`, which left the closing tag's two leading
spaces in front of the block, so the injected anchor came out at six
spaces instead of four. Now matched against the indented tag.
Both are specific to the NVIDIA index. `append_preview_numpy_wheels()`
is unaffected and untouched: the PyPI simple index puts its anchors at
indent 0, has `</body>` at column 0, and does terminate its last anchor
with a `<br/>` -- confirmed against the live
https://download.pytorch.org/whl/nightly/numpy/ index, whose injected
links are correctly indented and separated.
## Verification
Ran the full `upload_package_using_simple_index` path against the live
upstream index with a stubbed S3:
- injected anchor indent is 4 (was 6), and the preceding upstream anchor
now ends with `<br/>`
- exactly one `<br/>` added, no `<br/><br/>`, and re-running on
already-patched HTML is a no-op
- pip's `parse_links` still returns 151 links, with the root-relative
href resolving against the serving host and the sha256 recognised
- stripping tags and expanding `<br>` puts the last two wheels on
separate rendered lines1 parent 90a18ed commit a6bcfcb
1 file changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
1205 | | - | |
1206 | | - | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
1207 | 1217 | | |
1208 | 1218 | | |
1209 | 1219 | | |
| |||
0 commit comments