From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 9C8C93858409; Mon, 7 Nov 2022 14:18:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9C8C93858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667830735; bh=okwZ2qQMb8n4ePYM7s+VQceZa3iuIxYa7YZV+IpAE8Y=; h=From:To:Subject:Date:From; b=MWj+zWG2Bi3p9dyxb3d/5qLzC4zp5jFSBmZc4PLtmkQp9N0KimSeYUuP4l8rxBWk9 50wfdtuOpQjOtjhaWPxatkHb9mH0OnhNR0U+4sMj+fVcVg/qxs+hDhB72+092z3Krs Cd2E6UTdN/UjSf0eJDh6SrtXThR28f3TCIWAQQhk= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/sphinx-final)] sphinx: update baseconf.py file X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/sphinx-final X-Git-Oldrev: 5b5c326c5a7dfe65e2058b211ce21c21cb94929b X-Git-Newrev: 9bac3d4d5e85d5a5f83d6f19919a26d8ec396f01 Message-Id: <20221107141855.9C8C93858409@sourceware.org> Date: Mon, 7 Nov 2022 14:18:55 +0000 (GMT) List-Id: https://gcc.gnu.org/g:9bac3d4d5e85d5a5f83d6f19919a26d8ec396f01 commit 9bac3d4d5e85d5a5f83d6f19919a26d8ec396f01 Author: Martin Liska Date: Mon Nov 7 12:59:25 2022 +0100 sphinx: update baseconf.py file ChangeLog: * doc/baseconf.py: Port to GCC sources. Diff: --- doc/baseconf.py | 70 ++++++++++++++++++++++----------------------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/doc/baseconf.py b/doc/baseconf.py index 2eea8298dae..6993ba5eef6 100644 --- a/doc/baseconf.py +++ b/doc/baseconf.py @@ -11,7 +11,7 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os -import subprocess +import time import sys # sys.path.insert(0, os.path.abspath('.')) @@ -22,28 +22,16 @@ sys.setrecursionlimit(2000) # The full version, including alpha/beta/rc tags -# FIXME folder = os.path.dirname(os.path.realpath(__file__)) -gcc_srcdir = os.path.join(folder, './objdir') +gcc_srcdir = os.path.join(folder, '..', 'gcc') - -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] @@ -51,15 +39,17 @@ def __get_builder_name(): 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', '(GCC)') -BUGURL = os.getenv('BUGURL', 'https://gcc.gnu.org/bugs/') +VERSION_PACKAGE = os.getenv('VERSION_PACKAGE') +BUGURL = os.getenv('BUGURL') MONOCHROMATIC = os.getenv('MONOCHROMATIC') +YEAR = time.strftime('%Y') + # The short X.Y version. version = gcc_BASEVER @@ -80,10 +70,14 @@ needs_sphinx = '5.3' rst_epilog = ''' .. |gcc_version| replace:: %s -.. |package_version| replace:: %s -.. |bugurl| replace:: %s -.. |needs_sphinx| replace:: %s -''' % (gcc_BASEVER, VERSION_PACKAGE, BUGURL, needs_sphinx) +.. |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 # -- General configuration --------------------------------------------------- @@ -130,18 +124,14 @@ html_theme_options = { 'navigation_with_keys': True, } -html_logo = '../logo.svg' +html_logo = os.path.join(folder, 'logo.svg') -html_favicon = '../favicon.ico' +html_favicon = os.path.join(folder, 'favicon.ico') html_last_updated_fmt = '' -html_context = { - 'commit': __get_git_revision() -} - html_static_path = [ - '../_static' + os.path.join(folder, '_static') ] html_css_files = [ @@ -159,7 +149,7 @@ suppress_warnings = [ # Use xelatex by default latex_engine = 'xelatex' -latex_logo = '../logo.pdf' +latex_logo = os.path.join(folder, 'logo.pdf') latex_elements = { 'pointsize': '11pt', @@ -183,12 +173,6 @@ latex_table_style = ['colorrows'] 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' @@ -200,14 +184,14 @@ linkcheck_ignore = [ 'https://github.com/.*#.*' ] -USER_LEVEL_DOCS = ('install', 'gcc', 'gfortran', 'cpp', 'gnat_rm', 'gnat_ugn', +USER_LEVEL_DOCS = ('install', 'gcc', 'fortran', 'cpp', 'gnat_rm', 'gnat_ugn', '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://splichal.eu/scripts/sphinx/{manual}/_build/html/', None) + intersphinx_mapping[manual] = (f'https://gcc.gnu.org/onlinedocs/{manual}/', None) # Custom references extlinks = { @@ -226,5 +210,5 @@ def set_common(name, module): module['todo_include_todos'] = True module['tags'].add('development') - html_theme_options['source_edit_link'] = f'https://splichal.eu/scripts/sphinx/{name}' \ - '/_build/html/_sources/{filename}.txt' + html_theme_options['source_edit_link'] = f'https://gcc.gnu.org/onlinedocs/{name}' \ + '/_sources/{filename}.txt'