Commit a0651a2
committed
Fix Marker non-version-to-version eval failing
As described in my previous commit to add test cases covering this
behaviour, PEP 508 - Environment Markers section specifies that markers
are evaluated using version operator rules when both sides are valid
versions, and otherwise regular python operator rules apply.
However, the implementation was failing to handle the case where the RHS
was a valid version specifier, but the LHS was not a valid version. In
this case, PEP 508 requires the comparison falls back to python rules,
but the implementation was throwing InvalidVersion.
The implementation now matches the behaviour in the spec, as we now
check that both the LHS and the RHS are versions before attempting
version comparison (not just the RHS as before).1 parent a861e17 commit a0651a2
1 file changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
178 | 186 | | |
179 | 187 | | |
180 | | - | |
| 188 | + | |
| 189 | + | |
181 | 190 | | |
182 | 191 | | |
183 | | - | |
| 192 | + | |
184 | 193 | | |
185 | 194 | | |
186 | 195 | | |
| |||
0 commit comments