File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed
Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
2- #
2+
33# Mypy documentation build configuration file, created by
44# sphinx-quickstart on Sun Sep 14 19:50:35 2014.
5- #
5+
66# This file is execfile()d with the current directory set to its
77# containing dir.
8- #
8+
99# Note that not all possible configuration values are present in this
1010# autogenerated file.
11- #
11+
1212# All configuration values have a default; values that are commented out
1313# serve to show the default.
1414
112112# a list of builtin themes.
113113html_theme = "furo"
114114
115+ import os
116+ import subprocess
117+
118+ def get_git_branch ():
119+ try :
120+ # Check if running on ReadTheDocs
121+ if os .environ .get ("READTHEDOCS" ) == "True" :
122+ return os .environ .get ("READTHEDOCS_GIT_IDENTIFIER" , "master" )
123+
124+ # Otherwise, get the current branch from git locally
125+ return subprocess .check_output (
126+ ["git" , "rev-parse" , "--abbrev-ref" , "HEAD" ]
127+ ).decode ("utf-8" ).strip ()
128+ except Exception :
129+ return "master"
130+
131+ current_branch = get_git_branch ()
132+
115133html_theme_options = {
116134 "source_repository" : "https://github.com/python/mypy" ,
117- "source_branch" : "master" ,
135+ "source_branch" : current_branch ,
118136 "source_directory" : "docs/source" ,
119137}
120138
You can’t perform that action at this time.
0 commit comments