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

Function _version_split

tools/gyp/pylib/packaging/specifiers.py:646–665  ·  view source on GitHub ↗

Split version into components. The split components are intended for version comparison. The logic does not attempt to retain the original version string, so joining the components back with :func:`_version_join` may not produce the original version string.

(version: str)

Source from the content-addressed store, hash-verified

644
645
646def _version_split(version: str) -> List[str]:
647 """Split version into components.
648
649 The split components are intended for version comparison. The logic does
650 not attempt to retain the original version string, so joining the
651 components back with :func:`_version_join` may not produce the original
652 version string.
653 """
654 result: List[str] = []
655
656 epoch, _, rest = version.rpartition("!")
657 result.append(epoch or "0")
658
659 for item in rest.split("."):
660 match = _prefix_regex.search(item)
661 if match:
662 result.extend(match.groups())
663 else:
664 result.append(item)
665 return result
666
667
668def _version_join(components: List[str]) -> str:

Callers 2

_compare_compatibleMethod · 0.85
_compare_equalMethod · 0.85

Calls 5

rpartitionMethod · 0.45
appendMethod · 0.45
splitMethod · 0.45
searchMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected