Don't create more Path objects
Co-authored-by: Florian Bruhin <me@the-compiler.org>
This commit is contained in:
parent
e697956168
commit
649af829fe
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue