fix: Handle comma-separated version ranges in pre-release CDK check (#69292)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
24078cc171
commit
83c19a036f
@@ -96,13 +96,32 @@ def parse_cdk_dependency(pyproject_path) -> dict:
|
||||
|
||||
|
||||
def is_prerelease_version(version_str) -> bool:
|
||||
"""Check if version string represents a standard published version."""
|
||||
"""Check if version string represents a standard published version.
|
||||
|
||||
Handles comma-separated version ranges like ">=6.61.6,<7.0" by validating
|
||||
each constraint separately. Returns True if any constraint is invalid or
|
||||
contains prerelease markers.
|
||||
"""
|
||||
if not version_str:
|
||||
return True
|
||||
|
||||
version_pattern = r"^[~^>=<]*\d+\.\d+\.\d+([a-zA-Z0-9\-\.]*)?$"
|
||||
is_prod_version = bool(re.match(version_pattern, version_str.strip()))
|
||||
return not is_prod_version
|
||||
parts = [p.strip() for p in version_str.split(",") if p.strip()]
|
||||
|
||||
constraint_pattern = re.compile(r"^(?:\^|~|~=|==|!=|<=|>=|<|>)?\s*\d+(?:\.\d+){0,2}\s*$")
|
||||
|
||||
prerelease_pattern = re.compile(r"(?:a|alpha|b|beta|c|rc|pre|preview|dev)\d*$", re.IGNORECASE)
|
||||
|
||||
for part in parts:
|
||||
if "*" in part or "x" in part.lower():
|
||||
return True
|
||||
|
||||
if prerelease_pattern.search(part):
|
||||
return True
|
||||
|
||||
if not constraint_pattern.match(part):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def format_extras_for_poetry(extras) -> str:
|
||||
|
||||
Reference in New Issue
Block a user