summaryrefslogtreecommitdiff
path: root/qutebrowser
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-26 11:13:41 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-26 11:13:41 +0100
commit6bb2b082c94c96197daa3c161ec628fd18fd2041 (patch)
tree715e30029570e8bb8f0c3ee96322ac15aa51a00d /qutebrowser
parent2f918b98769bd9dbaf263e810e9cc79567cfbee3 (diff)
downloadqutebrowser-6bb2b082c94c96197daa3c161ec628fd18fd2041.tar.gz
qutebrowser-6bb2b082c94c96197daa3c161ec628fd18fd2041.zip
Remove pkg_resources special casing for PyInstaller
See #4467
Diffstat (limited to 'qutebrowser')
-rw-r--r--qutebrowser/utils/utils.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py
index 4ae0c9cab..85d1612c7 100644
--- a/qutebrowser/utils/utils.py
+++ b/qutebrowser/utils/utils.py
@@ -208,24 +208,12 @@ def read_file(filename: str, binary: bool = False) -> Any:
if not binary and filename in _resource_cache:
return _resource_cache[filename]
- if hasattr(sys, 'frozen'):
- # PyInstaller doesn't support pkg_resources :(
- # https://github.com/pyinstaller/pyinstaller/wiki/FAQ#misc
- fn = os.path.join(os.path.dirname(sys.executable), filename)
- if binary:
- f: IO
- with open(fn, 'rb') as f:
- return f.read()
- else:
- with open(fn, 'r', encoding='utf-8') as f:
- return f.read()
- else:
- p = importlib_resources.files(qutebrowser) / filename
+ p = importlib_resources.files(qutebrowser) / filename
- if binary:
- return p.read_bytes()
+ if binary:
+ return p.read_bytes()
- return p.read_text()
+ return p.read_text()
def resource_filename(filename: str) -> str: