@@ -175,23 +175,30 @@ def requirements(self):
175175 See https://github.com/python/cpython/issues/91483
176176
177177 """
178- if self .name == "3.5" :
179- return ["jieba" , "blurb" , "sphinx==1.8.4" , "jinja2<3.1" , "docutils<=0.17.1" ]
180- if self .name in {"3.7" , "3.6" , "2.7" }:
181- return ["jieba" , "blurb" , "sphinx==2.3.1" , "jinja2<3.1" , "docutils<=0.17.1" ]
182-
183- return [
178+ dependencies = [
184179 "jieba" , # To improve zh search.
185180 "PyStemmer~=2.2.0" , # To improve performance for word stemming.
186181 "-rrequirements.txt" ,
187182 ]
183+ if self .as_tuple () >= (3 , 11 ):
184+ return dependencies
185+ if self .as_tuple () >= (3 , 8 ):
186+ # Restore the imghdr module for Python 3.8-3.10.
187+ return dependencies + ["standard-imghdr" ]
188+
189+ # Requirements/constraints for Python 3.7 and older, pre-requirements.txt
190+ reqs = ["jieba" , "blurb" , "jinja2<3.1" , "docutils<=0.17.1" , "standard-imghdr" ]
191+ if self .name in {"3.7" , "3.6" , "2.7" }:
192+ return reqs + ["sphinx==2.3.1" ]
193+ if self .name == "3.5" :
194+ return reqs + ["sphinx==1.8.4" ]
188195
189196 @property
190197 def changefreq (self ):
191198 """Estimate this version change frequency, for the sitemap."""
192199 return {"EOL" : "never" , "security-fixes" : "yearly" }.get (self .status , "daily" )
193200
194- def as_tuple (self ):
201+ def as_tuple (self ) -> tuple [ int , ...] :
195202 """This version name as tuple, for easy comparisons."""
196203 return version_to_tuple (self .name )
197204
@@ -386,7 +393,7 @@ def update(self):
386393 self .clone () or self .fetch ()
387394
388395
389- def version_to_tuple (version ):
396+ def version_to_tuple (version ) -> tuple [ int , ...] :
390397 """Transform a version string to a tuple, for easy comparisons."""
391398 return tuple (int (part ) for part in version .split ("." ))
392399
0 commit comments