MCPcopy Create free account
hub / github.com/nodejs/node / _compare_less_than

Method _compare_less_than

tools/gyp/pylib/packaging/specifiers.py:455–478  ·  view source on GitHub ↗
(self, prospective: Version, spec_str: str)

Source from the content-addressed store, hash-verified

453 return Version(prospective.public) >= Version(spec)
454
455 def _compare_less_than(self, prospective: Version, spec_str: str) -> bool:
456
457 # Convert our spec to a Version instance, since we'll want to work with
458 # it as a version.
459 spec = Version(spec_str)
460
461 # Check to see if the prospective version is less than the spec
462 # version. If it's not we can short circuit and just return False now
463 # instead of doing extra unneeded work.
464 if not prospective < spec:
465 return False
466
467 # This special case is here so that, unless the specifier itself
468 # includes is a pre-release version, that we do not accept pre-release
469 # versions for the version mentioned in the specifier (e.g. <3.1 should
470 # not match 3.1.dev0, but should match 3.0.dev0).
471 if not spec.is_prerelease and prospective.is_prerelease:
472 if Version(prospective.base_version) == Version(spec.base_version):
473 return False
474
475 # If we've gotten to here, it means that prospective version is both
476 # less than the spec version *and* it's not a pre-release of the same
477 # version in the spec.
478 return True
479
480 def _compare_greater_than(self, prospective: Version, spec_str: str) -> bool:
481

Callers

nothing calls this directly

Calls 1

VersionClass · 0.70

Tested by

no test coverage detected