@@ -175,23 +175,30 @@ def requirements(self):
175
175
See https://github.com/python/cpython/issues/91483
176
176
177
177
"""
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 = [
184
179
"jieba" , # To improve zh search.
185
180
"PyStemmer~=2.2.0" , # To improve performance for word stemming.
186
181
"-rrequirements.txt" ,
187
182
]
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" ]
188
195
189
196
@property
190
197
def changefreq (self ):
191
198
"""Estimate this version change frequency, for the sitemap."""
192
199
return {"EOL" : "never" , "security-fixes" : "yearly" }.get (self .status , "daily" )
193
200
194
- def as_tuple (self ):
201
+ def as_tuple (self ) -> tuple [ int , ...] :
195
202
"""This version name as tuple, for easy comparisons."""
196
203
return version_to_tuple (self .name )
197
204
@@ -386,7 +393,7 @@ def update(self):
386
393
self .clone () or self .fetch ()
387
394
388
395
389
- def version_to_tuple (version ):
396
+ def version_to_tuple (version ) -> tuple [ int , ...] :
390
397
"""Transform a version string to a tuple, for easy comparisons."""
391
398
return tuple (int (part ) for part in version .split ("." ))
392
399
0 commit comments