From 0de43e34381f0028320e3fdc95b8b8e9c0908116 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 16 Feb 2019 01:05:27 +0100 Subject: [PATCH] _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 --- qutebrowser/browser/qutescheme.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index ac8caf6ee..d91022cca 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -32,7 +32,6 @@ import textwrap import urllib import collections import base64 -import os.path try: import secrets @@ -342,18 +341,10 @@ 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)) - except OSError: - pass - - return None + try: + return utils.read_file(path) + except OSError: + return None @add_handler('help')