depot/third_party/nixpkgs/pkgs/development/python-modules/matplotlib/darwin-sandbox-crash.patch
Default email f34ce41345 Project import generated by Copybara.
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
2024-07-27 08:49:29 +02:00

14 lines
645 B
Diff

--- a/lib/matplotlib/font_manager.py
+++ b/lib/matplotlib/font_manager.py
@@ -266,8 +266,11 @@ def _get_fontconfig_fonts():
@lru_cache
def _get_macos_fonts():
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``."""
- d, = plistlib.loads(
- subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
+ try:
+ d, = plistlib.loads(
+ subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
+ except (OSError, subprocess.CalledProcessError, plistlib.InvalidFileException):
+ return []
return [Path(entry["path"]) for entry in d["_items"]]