Make use of pathlib nearly everywhere (breaks docs gen)

Python 3.6 introduced support for the os.PathLike interface,
which means Python 3.5 did not have it yet and attempting to
use it in os functions would fail. Instead we can use pathlib
for everything, but not all work is done yet.
This commit is contained in:
Lonami Exo
2018-12-21 13:24:16 +01:00
parent b9d4eb5449
commit 8224e5aabf
7 changed files with 71 additions and 82 deletions

View File

@@ -54,7 +54,7 @@ class DocsWriter:
<body>
<div id="main_div">''',
title=title,
rel_css=relative_css_path.rstrip('/'),
rel_css=str(relative_css_path).rstrip('/'),
def_css=default_css
)
@@ -278,10 +278,7 @@ class DocsWriter:
# With block
def __enter__(self):
# Sanity check
parent = os.path.dirname(self.filename)
if parent:
os.makedirs(parent, exist_ok=True)
self.filename.parent.mkdir(parents=True, exist_ok=True)
self.handle = open(self.filename, 'w', encoding='utf-8')
return self