2222from datetime import datetime
2323import time
2424
25+ # Release mode enables optimizations and other related options.
26+ _doc_release_mode = tags .has ('release' ) # noqa
27+
2528# are we running circle CI?
2629CIRCLECI = 'CIRCLECI' in os .environ
2730
@@ -175,10 +178,10 @@ def _check_dependencies():
175178 'remove_config_comments' : True ,
176179 'min_reported_time' : 1 ,
177180 'thumbnail_size' : (320 , 224 ),
178- 'compress_images' : () if CIRCLECI else ( 'thumbnails' , 'images' ),
181+ 'compress_images' : ('thumbnails' , 'images' ) if _doc_release_mode else ( ),
179182 'matplotlib_animations' : True ,
180- # 3.7 CI doc build should not use hidpi images during the testing phase
181- 'image_srcset' : [] if sys . version_info [: 2 ] == ( 3 , 7 ) else ["2x" ],
183+ # Doc build should not use hidpi images during the testing phase.
184+ 'image_srcset' : ["2x" ] if _doc_release_mode else [],
182185 'junit' : '../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '' ,
183186}
184187
@@ -293,7 +296,7 @@ def _check_dependencies():
293296html_logo = "_static/logo2.svg"
294297html_theme_options = {
295298 "logo_link" : "index" ,
296- "collapse_navigation" : True if CIRCLECI else False ,
299+ "collapse_navigation" : not _doc_release_mode ,
297300 "icon_links" : [
298301 {
299302 "name" : "gitter" ,
@@ -319,7 +322,7 @@ def _check_dependencies():
319322 "show_prev_next" : False ,
320323 "navbar_center" : ["mpl_nav_bar.html" ],
321324}
322- include_analytics = False
325+ include_analytics = _doc_release_mode
323326if include_analytics :
324327 html_theme_options ["google_analytics_id" ] = "UA-55954603-1"
325328
0 commit comments