Skip to content

Commit c353935

Browse files
committed
debug ci pipeline
Signed-off-by: Cagri Yonca <cagri@ibm.com>
1 parent 66cd876 commit c353935

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.circleci/pin_safe_versions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from datetime import datetime, timedelta
2222

2323
import requests
24+
from packaging.specifiers import SpecifierSet
2425
from packaging.version import Version
2526

2627
GRACE_PERIOD_DAYS = 5
@@ -34,6 +35,8 @@ def _get_pypi_releases(package_name: str) -> list[Any]:
3435
except Exception:
3536
return []
3637

38+
current_python = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
39+
3740
result = []
3841
for ver, files in data["releases"].items():
3942
if not files or re.search(r"(a|b|rc|dev)\d*$", ver, re.I):
@@ -42,6 +45,15 @@ def _get_pypi_releases(package_name: str) -> list[Any]:
4245
Version(ver)
4346
except Exception:
4447
continue
48+
requires_python = next(
49+
(f["requires_python"] for f in files if f.get("requires_python")), None
50+
)
51+
if requires_python:
52+
try:
53+
if not SpecifierSet(requires_python).contains(current_python):
54+
continue
55+
except Exception:
56+
pass
4557
upload_time = files[-1].get("upload_time_iso_8601", "")
4658
match = re.search(r"([\d-]+)T", upload_time)
4759
if not match:

0 commit comments

Comments
 (0)