| 123456789101112131415161718192021222324 |
- Subject: Handle unknown platforms gracefully in loader.py
- Origin: upstream, commit 0.4.27-32-g0a2fda3 <https://github.com/ahupp/python-magic/commit/0.4.27-32-g0a2fda3>
- Author: Adam Hupp <adam@hupp.org>
- Date: Sun May 26 01:01:34 2024 -0700
- --- a/magic/loader.py
- +++ b/magic/loader.py
- @@ -49,7 +49,9 @@
- "darwin": _lib_candidates_macos,
- "linux": _lib_candidates_linux,
- "win32": _lib_candidates_windows,
- - }[sys.platform]
- + }.get(sys.platform)
- + if func is None:
- + raise ImportError("python-magic: Unsupported platform: " + sys.platform)
- # When we drop legacy Python, we can just `yield from func()`
- for path in func():
- yield path
- @@ -65,4 +67,4 @@
- pass
-
- # It is better to raise an ImportError since we are importing magic module
- - raise ImportError("failed to find libmagic. Check your installation")
- + raise ImportError("python-magic: failed to find libmagic. Check your installation")
|