From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 6AF483851884; Mon, 14 Nov 2022 08:38:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AF483851884 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668415112; bh=IgMzCSRXcWIaBgsEATgjy4h70DWN4+jpvBZrcSYmqxY=; h=From:To:Subject:Date:From; b=K1+9t80Tqke7QbeOml52rYGTVxkleY5KtC1P0EGW12yhHh5nKoJzQ4vW04JHDytMA KUQa37kVLGyj99+LiXLuQsWfruepeW24W3kkS1/I5nTNrKjgObDBtTgjrPYkUM0a1p cLTGqxi3W25IUXsVeT1CKalqHw+rLkQbaHp5NH48= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3984] Revert "sphinx: add update_web_docs_git.py script" X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: 50b2e0fc3604e9f69a5e3b6ad1902e681764edc5 X-Git-Newrev: c909a4af728c7e1b2b93b99effcd7ba6e15290b7 Message-Id: <20221114083832.6AF483851884@sourceware.org> Date: Mon, 14 Nov 2022 08:38:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c909a4af728c7e1b2b93b99effcd7ba6e15290b7 commit r13-3984-gc909a4af728c7e1b2b93b99effcd7ba6e15290b7 Author: Martin Liska Date: Sun Nov 13 21:58:31 2022 +0100 Revert "sphinx: add update_web_docs_git.py script" This reverts commit 6373b1fdf75ea0908dfaebdbfc54d8b55b08d409. Diff: --- maintainer-scripts/update_web_docs_git.py | 81 ------------------------------- 1 file changed, 81 deletions(-) diff --git a/maintainer-scripts/update_web_docs_git.py b/maintainer-scripts/update_web_docs_git.py deleted file mode 100755 index f3f59953ac0..00000000000 --- a/maintainer-scripts/update_web_docs_git.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 - -# Generate documentation from Sphinx files. - -import argparse -import os -import shutil -import subprocess -import tempfile -from pathlib import Path - -GITROOT = '/git/gcc.git' -BUGURL = 'https://gcc.gnu.org/bugs/' - -parser = argparse.ArgumentParser(description='Update web documentation.') -parser.add_argument('output_folder', help='Output folder') -parser.add_argument('--gitrepo', help=f'Git repository (default: {GITROOT})', - default=GITROOT) -parser.add_argument('--sphinx-build', help='Path to sphinx-build binary') -parser.add_argument('-v', '--verbose', action='store_true', - help='Verbose output') -args = parser.parse_args() - - -def find_configs(): - for root, _, files in os.walk('.'): - for f in files: - full = os.path.join(root, f) - if f == 'conf.py': - # find name of the documentation - lines = open(full).read().splitlines() - docname = None - for line in lines: - if line.startswith('name = '): - docname = line.split()[-1].strip("'") - break - assert docname - yield (Path(root).resolve(), docname) - - -with tempfile.TemporaryDirectory() as folder: - print(f'Using {folder} as temporary directory') - os.chdir(folder) - subprocess.check_output(f'git clone {args.gitrepo} --depth=1', shell=True) - os.chdir('gcc') - configs = list(find_configs()) - - # Prepare folders - output = Path(args.output_folder) - if not output.exists(): - output.mkdir() - - temp = Path('tmp').resolve() - temp.mkdir() - - # Prepare default env. variables - childenv = os.environ.copy() - childenv['BUGURL'] = BUGURL - - # Build and copy the documentation - for i, (config_folder, docname) in enumerate(sorted(configs)): - print(f'=== building {i + 1}/{len(configs)}: {docname} ===') - - # Build HTML - cmd = f'make -C doc html SOURCEDIR={config_folder} BUILDDIR={temp}/{docname}' - if args.sphinx_build: - cmd += f' SPHINXBUILD={args.sphinx_build}' - subprocess.run(cmd, shell=True, env=childenv, check=True, - capture_output=not args.verbose) - os.unlink(f'{temp}/{docname}/html/.buildinfo') - shutil.copytree(f'{temp}/{docname}/html', f'{output}/{docname}', - dirs_exist_ok=True) - - # Build PDF - cmd = f'make -C doc latexpdf SOURCEDIR={config_folder} BUILDDIR={temp}/pdf/{docname}' - if args.sphinx_build: - cmd += f' SPHINXBUILD={args.sphinx_build}' - subprocess.run(cmd, shell=True, env=childenv, check=True, - capture_output=not args.verbose) - shutil.copyfile(f'{temp}/pdf/{docname}/latex/{docname}.pdf', - f'{output}/{docname}.pdf')