From patchwork Thu Nov 10 05:33:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 60331 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35BDA384603C for ; Thu, 10 Nov 2022 05:33:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id DA6C23858D28 for ; Thu, 10 Nov 2022 05:33:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DA6C23858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 91E2933909 for ; Thu, 10 Nov 2022 05:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1668058397; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v/UrcVMoaOI4SUSKlvvUpTdqgx3mmNDifELVRau4ghE=; b=damm7g1tm/r3dctnO8TnOKjuTLRq+M2saTQaffsku5YXsVhgw3V9/fyfHO+wT4FJGw0Du5 c6XbARl80r7VkZMg8Hz5qNaDoc8b18G5SZ1Vv/AE0MPIQDu6slMH3C0orLs1ADXdZUi/aH 4RgXoX0tyTdZ2z2LaW8i/MP2bDhsiF4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1668058397; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v/UrcVMoaOI4SUSKlvvUpTdqgx3mmNDifELVRau4ghE=; b=QPR4Vp8wA7iKH/cjKx7iFJ9za7k4uLOv0cE/vwywkO4EQHbzcPt7m0trDJvs4zMfrVPhhP kUDM8HXoZnAOMZBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 853D313479 for ; Thu, 10 Nov 2022 05:33:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SBetHx2NbGNSaAAAMHmgww (envelope-from ) for ; Thu, 10 Nov 2022 05:33:17 +0000 Message-ID: <9731aeaa-c81b-8862-0f74-5715725f5a14@suse.cz> Date: Thu, 10 Nov 2022 06:33:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH (pushed)] doc: Modernize baseconf.py. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Pushed. ChangeLog: * doc/baseconf.py: Modernize by using pathlib. --- doc/baseconf.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/doc/baseconf.py b/doc/baseconf.py index d85659e4540..8021a101e77 100644 --- a/doc/baseconf.py +++ b/doc/baseconf.py @@ -11,29 +11,31 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. # import os -import time import sys +import time +from pathlib import Path -# gccint needs a deeper stack limit -sys.setrecursionlimit(2000) +# Build paths and add path to gcc_sphinx.py extension. +folder = Path(__file__).resolve().parent +doc_modules = folder / 'modules' +gcc_srcdir = folder / '..' / 'gcc' -# -- Project information ----------------------------------------------------- +sys.path.insert(0, str(doc_modules)) -# The full version, including alpha/beta/rc tags +# gccint needs a deeper stack limit. +sys.setrecursionlimit(2000) -folder = os.path.dirname(os.path.realpath(__file__)) -doc_modules = os.path.join(folder, 'modules') -gcc_srcdir = os.path.join(folder, '..', 'gcc') +# -- Project information ----------------------------------------------------- -sys.path.insert(0, doc_modules) def read_file(name): - path = os.path.join(gcc_srcdir, name) - if os.path.exists(path): + path = gcc_srcdir / name + if path.exists(): return open(path).read().strip() else: return '' + def __get_builder_name(): if '-b' in sys.argv: return sys.argv[sys.argv.index('-b') + 1] @@ -124,14 +126,14 @@ html_theme_options = { 'navigation_with_keys': True, } -html_logo = os.path.join(folder, 'logo.svg') +html_logo = str(folder / 'logo.svg') -html_favicon = os.path.join(folder, 'favicon.ico') +html_favicon = str(folder / 'favicon.ico') html_last_updated_fmt = '' html_static_path = [ - os.path.join(folder, '_static') + str(folder / '_static') ] html_css_files = [ @@ -149,7 +151,7 @@ suppress_warnings = [ # Use xelatex by default latex_engine = 'xelatex' -latex_logo = os.path.join(folder, 'logo.pdf') +latex_logo = str(folder / 'logo.pdf') latex_elements = { 'pointsize': '11pt', @@ -215,4 +217,4 @@ def set_common(name, module): module['tags'].add('development') html_theme_options['source_edit_link'] = f'https://gcc.gnu.org/onlinedocs/{name}' \ - '/_sources/{filename}.txt' + '/_sources/{filename}.txt'