diff options
| author | K900 <me@0upti.me> | 2024-07-02 14:26:58 +0300 |
|---|---|---|
| committer | K900 <me@0upti.me> | 2024-07-02 14:26:58 +0300 |
| commit | dcfcc10af50ca250e7f9725db59a297bf8896f18 (patch) | |
| tree | c5a419ddb45be65ba19d1eb5f17a40c29fc89252 /pkgs/development/python-modules/matplotlib | |
| parent | 7b8429bbc41fcd68e4b1bc1d10ed290543282210 (diff) | |
python312Packages.matplotlib: fix running in the Darwin sandbox
Diffstat (limited to 'pkgs/development/python-modules/matplotlib')
| -rw-r--r-- | pkgs/development/python-modules/matplotlib/darwin-sandbox-crash.patch | 14 | ||||
| -rw-r--r-- | pkgs/development/python-modules/matplotlib/default.nix | 6 |
2 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/matplotlib/darwin-sandbox-crash.patch b/pkgs/development/python-modules/matplotlib/darwin-sandbox-crash.patch new file mode 100644 index 000000000000..883f1edc8be0 --- /dev/null +++ b/pkgs/development/python-modules/matplotlib/darwin-sandbox-crash.patch @@ -0,0 +1,14 @@ +--- 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"]] diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix index b82880c3694a..66436a2d2669 100644 --- a/pkgs/development/python-modules/matplotlib/default.nix +++ b/pkgs/development/python-modules/matplotlib/default.nix @@ -100,6 +100,12 @@ buildPythonPackage rec { hash = "sha256-5tKepsGeNLMPt9iLcIH4aaAwFPZv4G1izHfVpuqI7Xo="; }; + patches = lib.optionals stdenv.isDarwin [ + # Don't crash when running in Darwin sandbox + # Submitted upstream: https://github.com/matplotlib/matplotlib/pull/28498 + ./darwin-sandbox-crash.patch + ]; + env.XDG_RUNTIME_DIR = "/tmp"; # Matplotlib tries to find Tcl/Tk by opening a Tk window and asking the |
