_asciidoc_fallback_path: Remove reading from parent directories

Reading paths from outside the Python package worked in pkg_resources < 40.8.0
but got deprecated afterwards: https://github.com/pypa/setuptools/pull/1640

Since this isn't really any critical functionality, let's just not try reading
from there. We can still revisit this when the switch to Sphinx is complete.

Fixes #4576 (hopefully)
See #345
This commit is contained in:
Florian Bruhin 2019-02-16 01:05:27 +01:00
parent 6519ac5cca
commit 0de43e3438

View File

@ -32,7 +32,6 @@ import textwrap
import urllib
import collections
import base64
import os.path
try:
import secrets
@ -342,17 +341,9 @@ def qute_gpl(_url):
def _asciidoc_fallback_path(html_path):
"""Fall back to plaintext asciidoc if the HTML is unavailable."""
asciidoc_path = html_path.replace('.html', '.asciidoc')
asciidoc_paths = [asciidoc_path]
if asciidoc_path.startswith('html/doc/'):
asciidoc_paths += [asciidoc_path.replace('html/doc/', '../doc/help/'),
asciidoc_path.replace('html/doc/', '../doc/')]
for path in asciidoc_paths:
try:
return utils.read_file(os.path.normpath(path))
return utils.read_file(path)
except OSError:
pass
return None