From c9a72578ec479d0fa6a419bd801b887e97d3459a Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Tue, 12 Nov 2024 11:11:27 +0100 Subject: [PATCH] Handle != in min-deps script --- ci/scripts/min-deps.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ci/scripts/min-deps.py b/ci/scripts/min-deps.py index c6bac0cf4..b792ad8a8 100755 --- a/ci/scripts/min-deps.py +++ b/ci/scripts/min-deps.py @@ -1,4 +1,11 @@ #!/usr/bin/env python3 +# /// script +# dependencies = [ +# "tomli; python_version < '3.11'", +# "packaging", +# ] +# /// + from __future__ import annotations import argparse @@ -33,12 +40,14 @@ def min_dep(req: Requirement) -> Requirement: if req.extras: req_name = f"{req_name}[{','.join(req.extras)}]" - specs = [spec for spec in req.specifier if spec.operator in {">", ">=", "~=", "=="}] - if not specs: + filter_specs = [ + spec for spec in req.specifier if spec.operator in {"==", "~=", ">=", ">"} + ] + if not filter_specs: return Requirement(req_name) min_version = Version("0.0.0.a1") - for spec in specs: + for spec in filter_specs: if spec.operator in {">", ">=", "~="}: min_version = max(min_version, Version(spec.version)) elif spec.operator == "==":