@@ -196,23 +196,30 @@ def requirements(self):
196
196
See https://github.com/python/cpython/issues/91483
197
197
198
198
"""
199
- if self .name == "3.5" :
200
- return ["jieba" , "blurb" , "sphinx==1.8.4" , "jinja2<3.1" , "docutils<=0.17.1" ]
201
- if self .name in {"3.7" , "3.6" , "2.7" }:
202
- return ["jieba" , "blurb" , "sphinx==2.3.1" , "jinja2<3.1" , "docutils<=0.17.1" ]
203
-
204
- return [
199
+ dependencies = [
205
200
"jieba" , # To improve zh search.
206
201
"PyStemmer~=2.2.0" , # To improve performance for word stemming.
207
202
"-rrequirements.txt" ,
208
203
]
204
+ if self .as_tuple () >= (3 , 11 ):
205
+ return dependencies
206
+ if self .as_tuple () >= (3 , 8 ):
207
+ # Restore the imghdr module for Python 3.8-3.10.
208
+ return dependencies + ["standard-imghdr" ]
209
+
210
+ # Requirements/constraints for Python 3.7 and older, pre-requirements.txt
211
+ reqs = ["jieba" , "blurb" , "jinja2<3.1" , "docutils<=0.17.1" , "standard-imghdr" ]
212
+ if self .name in {"3.7" , "3.6" , "2.7" }:
213
+ return reqs + ["sphinx==2.3.1" ]
214
+ if self .name == "3.5" :
215
+ return reqs + ["sphinx==1.8.4" ]
209
216
210
217
@property
211
218
def changefreq (self ):
212
219
"""Estimate this version change frequency, for the sitemap."""
213
220
return {"EOL" : "never" , "security-fixes" : "yearly" }.get (self .status , "daily" )
214
221
215
- def as_tuple (self ):
222
+ def as_tuple (self ) -> tuple [ int , ...] :
216
223
"""This version name as tuple, for easy comparisons."""
217
224
return version_to_tuple (self .name )
218
225
@@ -407,7 +414,7 @@ def update(self):
407
414
self .clone () or self .fetch ()
408
415
409
416
410
- def version_to_tuple (version ):
417
+ def version_to_tuple (version ) -> tuple [ int , ...] :
411
418
"""Transform a version string to a tuple, for easy comparisons."""
412
419
return tuple (int (part ) for part in version .split ("." ))
413
420
0 commit comments