From 649af829fe9a400c3841731f964b1b4bb5c86045 Mon Sep 17 00:00:00 2001 From: Axel Dahlberg Date: Thu, 2 Jul 2020 13:18:12 +0200 Subject: [PATCH] Don't create more Path objects Co-authored-by: Florian Bruhin --- scripts/asciidoc2html.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index 59cd0da5f..0806a66eb 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -80,9 +80,9 @@ class AsciiDoc: def _build_docs(self) -> None: """Render .asciidoc files to .html sites.""" - files = [(pathlib.Path(REPO_ROOT, 'doc/{}.asciidoc'.format(f)), + files = [(REPO_ROOT / 'doc' / '{}.asciidoc'.format(f)), DOC_DIR / (f + ".html")) for f in self.FILES] - for src in pathlib.Path(REPO_ROOT, 'doc/help/').glob('*.asciidoc'): + for src in (REPO_ROOT / 'doc' / 'help').glob('*.asciidoc'): dst = DOC_DIR / (src.stem + ".html") files.append((src, dst)) @@ -112,7 +112,7 @@ class AsciiDoc: dst_path = DOC_DIR / 'img' dst_path.mkdir(exist_ok=True) for filename in ['cheatsheet-big.png', 'cheatsheet-small.png']: - src = pathlib.Path(REPO_ROOT, 'doc') / 'img' / filename + src = REPO_ROOT / 'doc' / 'img' / filename dst = dst_path / filename shutil.copy(str(src), str(dst)) @@ -126,7 +126,7 @@ class AsciiDoc: assert self._tempdir is not None # for mypy modified_src = self._tempdir / src.name - shutil.copy(os.path.join(REPO_ROOT, 'www/header.asciidoc'), modified_src) + shutil.copy(str(REPO_ROOT / 'www' / 'header.asciidoc'), modified_src) outfp = io.StringIO() @@ -182,7 +182,7 @@ class AsciiDoc: def _build_website(self) -> None: """Prepare and build the website.""" - theme_file = (pathlib.Path(REPO_ROOT, 'www') / 'qute.css').resolve() + theme_file = REPO_ROOT / 'www' / 'qute.css' assert self._themedir is not None # for mypy shutil.copy(theme_file, self._themedir) @@ -206,7 +206,7 @@ class AsciiDoc: for dst, link_name in [ ('README.html', 'index.html'), - ((pathlib.Path(REPO_ROOT, 'doc') / 'quickstart.html'), + ((REPO_ROOT / 'doc' / 'quickstart.html'), 'quickstart.html')]: assert isinstance(dst, (str, pathlib.Path)) # for mypy try: