(version)
| 221 | |
| 222 | |
| 223 | def _legacy_cmpkey(version): |
| 224 | # We hardcode an epoch of -1 here. A PEP 440 version can only have an epoch |
| 225 | # greater than or equal to 0. This will effectively put the LegacyVersion, |
| 226 | # which uses the defacto standard originally implemented by setuptools, |
| 227 | # as before all PEP 440 versions. |
| 228 | epoch = -1 |
| 229 | |
| 230 | # This scheme is taken from pkg_resources.parse_version setuptools prior to |
| 231 | # its adoption of the packaging library. |
| 232 | parts = [] |
| 233 | for part in _parse_version_parts(version.lower()): |
| 234 | if part.startswith("*"): |
| 235 | # remove "-" before a prerelease tag |
| 236 | if part < "*final": |
| 237 | while parts and parts[-1] == "*final-": |
| 238 | parts.pop() |
| 239 | |
| 240 | # remove trailing zeros from each series of numeric parts |
| 241 | while parts and parts[-1] == "00000000": |
| 242 | parts.pop() |
| 243 | |
| 244 | parts.append(part) |
| 245 | parts = tuple(parts) |
| 246 | |
| 247 | return epoch, parts |
| 248 | |
| 249 | |
| 250 | # Deliberately not anchored to the start and end of the string, to make it |
no test coverage detected
searching dependent graphs…