diff options
author | 2024-05-27 15:28:46 +0200 | |
---|---|---|
committer | 2024-05-27 15:39:08 +0200 | |
commit | b51651157a3da02a8a16d43e27ebe2ffc63d7e7e (patch) | |
tree | 41ef613920c5c1328dc05041f81ebfdb23faf848 /dev-python/ipython | |
parent | dev-python/ipython: Backport pytest-8 fixes (diff) | |
download | gentoo-b51651157a3da02a8a16d43e27ebe2ffc63d7e7e.tar.gz gentoo-b51651157a3da02a8a16d43e27ebe2ffc63d7e7e.tar.bz2 gentoo-b51651157a3da02a8a16d43e27ebe2ffc63d7e7e.zip |
dev-python/ipython: Backport matplotlib-3.9 fixes
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/ipython')
-rw-r--r-- | dev-python/ipython/files/ipython-8.24.0-mpl-3.9.patch | 72 | ||||
-rw-r--r-- | dev-python/ipython/ipython-8.24.0-r1.ebuild | 4 |
2 files changed, 75 insertions, 1 deletions
diff --git a/dev-python/ipython/files/ipython-8.24.0-mpl-3.9.patch b/dev-python/ipython/files/ipython-8.24.0-mpl-3.9.patch new file mode 100644 index 000000000000..927cc95ccf29 --- /dev/null +++ b/dev-python/ipython/files/ipython-8.24.0-mpl-3.9.patch @@ -0,0 +1,72 @@ +diff --git a/IPython/core/pylabtools.py b/IPython/core/pylabtools.py +index 1f5a11f37e..4287834418 100644 +--- a/IPython/core/pylabtools.py ++++ b/IPython/core/pylabtools.py +@@ -345,8 +345,10 @@ def find_gui_and_backend(gui=None, gui_select=None): + backend = matplotlib.rcParamsOrig["backend"] + backend, gui = backend_registry.resolve_backend(backend) + else: ++ gui = _convert_gui_to_matplotlib(gui) + backend, gui = backend_registry.resolve_gui_or_backend(gui) + ++ gui = _convert_gui_from_matplotlib(gui) + return gui, backend + + # Fallback to previous behaviour (Matplotlib < 3.9) +@@ -509,10 +511,28 @@ def _list_matplotlib_backends_and_gui_loops() -> list[str]: + if _matplotlib_manages_backends(): + from matplotlib.backends.registry import backend_registry + +- ret = backend_registry.list_all() + backend_registry.list_gui_frameworks() ++ ret = backend_registry.list_all() + [ ++ _convert_gui_from_matplotlib(gui) ++ for gui in backend_registry.list_gui_frameworks() ++ ] + else: + from IPython.core import pylabtools + + ret = list(pylabtools.backends.keys()) + + return sorted(["auto"] + ret) ++ ++ ++# Matplotlib and IPython do not always use the same gui framework name. ++# Always use the approprate one of these conversion functions when passing a ++# gui framework name to/from Matplotlib. ++def _convert_gui_to_matplotlib(gui: str | None) -> str | None: ++ if gui and gui.lower() == "osx": ++ return "macosx" ++ return gui ++ ++ ++def _convert_gui_from_matplotlib(gui: str | None) -> str | None: ++ if gui and gui.lower() == "macosx": ++ return "osx" ++ return gui +diff --git a/IPython/core/tests/test_pylabtools.py b/IPython/core/tests/test_pylabtools.py +index 4099f04044..6bddb34807 100644 +--- a/IPython/core/tests/test_pylabtools.py ++++ b/IPython/core/tests/test_pylabtools.py +@@ -276,11 +276,11 @@ def test_figure_no_canvas(): + # name is gui + ("gtk3", "gtk3", "gtk3agg"), + ("gtk4", "gtk4", "gtk4agg"), +- ("headless", "headless", "agg"), ++ ("headless", None, "agg"), + ("osx", "osx", "macosx"), + ("qt", "qt", "qtagg"), + ("qt5", "qt5", "qt5agg"), +- ("qt6", "qt6", "qt6agg"), ++ ("qt6", "qt6", "qtagg"), + ("tk", "tk", "tkagg"), + ("wx", "wx", "wxagg"), + # name is backend +@@ -301,8 +301,6 @@ def test_figure_no_canvas(): + ("qtcairo", "qt", "qtcairo"), + ("qt5agg", "qt5", "qt5agg"), + ("qt5cairo", "qt5", "qt5cairo"), +- ("qt6agg", "qt", "qt6agg"), +- ("qt6cairo", "qt", "qt6cairo"), + ("tkagg", "tk", "tkagg"), + ("tkcairo", "tk", "tkcairo"), + ("webagg", "webagg", "webagg"), diff --git a/dev-python/ipython/ipython-8.24.0-r1.ebuild b/dev-python/ipython/ipython-8.24.0-r1.ebuild index 799568843f24..abefb66944bd 100644 --- a/dev-python/ipython/ipython-8.24.0-r1.ebuild +++ b/dev-python/ipython/ipython-8.24.0-r1.ebuild @@ -45,7 +45,7 @@ BDEPEND=" test? ( app-text/dvipng[truetype] >=dev-python/ipykernel-5.1.0[${PYTHON_USEDEP}] - dev-python/matplotlib[${PYTHON_USEDEP}] + >=dev-python/matplotlib-3.9[${PYTHON_USEDEP}] dev-python/nbformat[${PYTHON_USEDEP}] >=dev-python/numpy-1.23[${PYTHON_USEDEP}] dev-python/matplotlib-inline[${PYTHON_USEDEP}] @@ -88,6 +88,8 @@ PATCHES=( "${FILESDIR}"/2.1.0-substitute-files.patch # https://github.com/ipython/ipython/pull/14441 "${FILESDIR}/${P}-pytest-8.patch" + # https://github.com/ipython/ipython/pull/14420 + "${FILESDIR}/${P}-mpl-3.9.patch" ) python_prepare_all() { |