Commit 5d005b5
committed
🐛 fix(discovery): match prerelease versions against major.minor specs
Python prerelease versions like 3.15.0a6 were incorrectly failing to match
version specifiers like >=3.15. This broke testing of prereleases in Fedora
and other environments that build libraries against alpha/beta Python versions.
The root cause was comparing the full version string "3.15.0a6" against
normalized specifier versions without accounting for precision. For a spec
like >=3.15 (two components), comparing against "3.15.0a6" failed because
PEP 440 defines prereleases as less than final releases.
The fix determines precision from the specifier's version string by counting
dots, then only includes the prerelease suffix when either the precision is
3 (full version like >=3.15.0) or the specifier itself contains a prerelease
marker (like >=3.15.0a1). This allows >=3.15 to match 3.15.0a6 by comparing
"3.15" to "3.15", while >=3.15.0 correctly rejects it by comparing "3.15.0a6"
to "3.15.0".
Fixes #451 parent c4ec5ca commit 5d005b5
2 files changed
Lines changed: 39 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
476 | 486 | | |
477 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
478 | 490 | | |
479 | 491 | | |
480 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
280 | 298 | | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
| |||
0 commit comments