# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
-import time
+import subprocess
import sys
# sys.path.insert(0, os.path.abspath('.'))
# The full version, including alpha/beta/rc tags
+# FIXME
folder = os.path.dirname(os.path.realpath(__file__))
-gcc_srcdir = os.path.join(folder, '..', 'gcc')
+gcc_srcdir = os.path.join(folder, './objdir')
-def read_file(name):
+
+def __read_file(name):
path = os.path.join(gcc_srcdir, name)
if os.path.exists(path):
return open(path).read().strip()
else:
return ''
+
+def __get_git_revision():
+ try:
+ r = subprocess.check_output('git rev-parse --short HEAD', shell=True, encoding='utf8',
+ stderr=subprocess.DEVNULL)
+ return r.strip()
+ except subprocess.CalledProcessError:
+ return None
+
+
def __get_builder_name():
if '-b' in sys.argv:
return sys.argv[sys.argv.index('-b') + 1]
return None
-gcc_BASEVER = read_file('BASE-VER')
-gcc_DEVPHASE = read_file('DEV-PHASE')
-gcc_DATESTAMP = read_file('DATESTAMP')
-gcc_REVISION = read_file('REVISION')
+gcc_BASEVER = __read_file('BASE-VER')
+gcc_DEVPHASE = __read_file('DEV-PHASE')
+gcc_DATESTAMP = __read_file('DATESTAMP')
+gcc_REVISION = __read_file('REVISION')
-VERSION_PACKAGE = os.getenv('VERSION_PACKAGE')
-BUGURL = os.getenv('BUGURL')
+VERSION_PACKAGE = os.getenv('VERSION_PACKAGE', '(GCC)')
+BUGURL = os.getenv('BUGURL', 'https://gcc.gnu.org/bugs/')
MONOCHROMATIC = os.getenv('MONOCHROMATIC')
-YEAR = time.strftime('%Y')
-
# The short X.Y version.
version = gcc_BASEVER
rst_epilog = '''
.. |gcc_version| replace:: %s
-.. |needs_sphinx| replace:: %s\n
-''' % (gcc_BASEVER, needs_sphinx)
-
-if BUGURL:
- rst_epilog += '.. |bugurl| replace:: %s\n' % BUGURL
-
-if VERSION_PACKAGE:
- rst_epilog += '.. |package_version| replace:: %s\n' % VERSION_PACKAGE
+.. |package_version| replace:: %s
+.. |bugurl| replace:: %s
+.. |needs_sphinx| replace:: %s
+''' % (gcc_BASEVER, VERSION_PACKAGE, BUGURL, needs_sphinx)
# -- General configuration ---------------------------------------------------
'navigation_with_keys': True,
}
-html_logo = os.path.join(folder, 'logo.svg')
+html_logo = '../logo.svg'
-html_favicon = os.path.join(folder, 'favicon.ico')
+html_favicon = '../favicon.ico'
html_last_updated_fmt = ''
+html_context = {
+ 'commit': __get_git_revision()
+}
+
html_static_path = [
- os.path.join(folder, '_static')
+ '../_static'
]
html_css_files = [
# Use xelatex by default
latex_engine = 'xelatex'
-latex_logo = os.path.join(folder, 'logo.pdf')
+latex_logo = '../logo.pdf'
latex_elements = {
'pointsize': '11pt',
latex_table_style = ['colorrows']
-# makeindex is much common on older systems
-latex_use_xindy = False
-
texinfo_cross_references = False
+texinfo_elements = {'preamble': """
+@definfoenclose strong,*,*
+@definfoenclose emph,','
+"""
+}
+
# Use default as RTD theme uses default as well
pygments_style = 'bw' if MONOCHROMATIC else 'default'
]
USER_LEVEL_DOCS = ('install', 'gcc', 'gfortran', 'cpp', 'gnat_rm', 'gnat_ugn',
- 'gccgo', 'gdc', 'libgomp', 'libquadmath', 'libitm', 'libgccjit')
-INTERNAL_DOCS = ('gccint', 'cppinternals', 'gfc-internals', 'gnat-style', 'libiberty')
+ 'gccgo', 'libgomp', 'libquadmath', 'libgccjit')
+INTERNAL_DOCS = ('gccint', 'cppinternals', 'gfc-internals', 'gnat-style')
# Cross manual reference mapping
intersphinx_mapping = {}
for manual in USER_LEVEL_DOCS + INTERNAL_DOCS:
- intersphinx_mapping[manual] = (f'https://gcc.gnu.org/onlinedocs/{manual}/', None)
+ intersphinx_mapping[manual] = (f'https://splichal.eu/scripts/sphinx/{manual}/_build/html/', None)
# Custom references
extlinks = {
module['todo_include_todos'] = True
module['tags'].add('development')
- html_theme_options['source_edit_link'] = f'https://gcc.gnu.org/onlinedocs/{name}' \
- '/_sources/{filename}.txt'
+ html_theme_options['source_edit_link'] = f'https://splichal.eu/scripts/sphinx/{name}' \
+ '/_build/html/_sources/{filename}.txt'