10
10
# The Python-aware NodeJS version regex
11
11
# This is very similar to `packaging.version.VERSION_PATTERN`, with a few changes:
12
12
# - Don't accept underscores
13
+ # - Only support three-component release and prerelease segments
13
14
# - Require - to indicate prerelease
14
15
NODE_VERSION_PATTERN = r"""
15
16
(?P<major>[0-9]+) # major
27
28
28
29
# The NodeJS-aware Python version regex
29
30
# This is very similar to `packaging.version.VERSION_PATTERN`, with a few changes:
30
- # - Don't accept epochs or local packages
31
- # - Require three components
31
+ # - Only support three-component release and prerelease segments
32
32
PYTHON_VERSION_PATTERN = r"""
33
33
v?
34
34
(?:
@@ -52,7 +52,6 @@ class NodeJSVersionSource(VersionSourceInterface):
52
52
53
53
def node_version_to_python (self , version : str ) -> str :
54
54
# NodeJS version strings are a near superset of Python version strings
55
- # We opt to read the pre.post.dev from the NodeJS pre field
56
55
match = re .match (
57
56
r"^\s*" + NODE_VERSION_PATTERN + r"\s*$" ,
58
57
version ,
@@ -73,7 +72,6 @@ def node_version_to_python(self, version: str) -> str:
73
72
74
73
def python_version_to_node (self , version : str ) -> str :
75
74
# NodeJS version strings are a near superset of Python version strings
76
- # We opt to read the pre.post.dev from the NodeJS pre field
77
75
match = re .match (
78
76
r"^\s*" + PYTHON_VERSION_PATTERN + r"\s*$" ,
79
77
version ,
0 commit comments