File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1096,6 +1096,8 @@ def has_c() -> bool:
1096
1096
1097
1097
1098
1098
class Version (tuple ):
1099
+ """A class that can be used to compare version strings."""
1100
+
1099
1101
def __new__ (cls , * version ):
1100
1102
padded_version = cls ._padded (version , 4 )
1101
1103
return super ().__new__ (cls , tuple (padded_version ))
@@ -1161,8 +1163,12 @@ def __str__(self):
1161
1163
1162
1164
def check_for_min_version (package_version : str , package_name : str ) -> tuple [str , bool ]:
1163
1165
package_version = Version .from_string (package_version )
1164
- requirement = (
1165
- [i for i in requires ("pymongo" ) if i .startswith (package_name )].next ().split (";" ).next ()
1166
- )
1166
+ # Dependency is expected to be in one of the forms:
1167
+ # "pymongocrypt<2.0.0,>=1.13.0; extra == 'encryption'"
1168
+ # 'dnspython<3.0.0,>=1.16.0'
1169
+ #
1170
+ requirement = [i for i in requires ("pymongo" ) if i .startswith (package_name )][0 ] # noqa: RUF015
1171
+ if ";" in requirement :
1172
+ requirement = requirement .split (";" )[0 ]
1167
1173
required_version = requirement [requirement .find (">=" ) + 2 :]
1168
1174
return required_version , package_version > Version .from_string (required_version )
You can’t perform that action at this time.
0 commit comments