python-matplotlib/0001-matplotlibrc-path-search-fix.patch

70 lines
2.7 KiB
Diff
Raw Normal View History

2021-01-28 09:31:52 +00:00
From 7d34e4c6cf3e9f0b68d0a7f70f5c832a24b74d7e Mon Sep 17 00:00:00 2001
2017-10-15 22:16:56 +00:00
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Wed, 27 Sep 2017 19:35:59 -0400
2020-11-12 06:35:38 +00:00
Subject: [PATCH 1/2] matplotlibrc path search fix
2017-10-15 22:16:56 +00:00
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
2020-06-30 00:38:52 +00:00
lib/matplotlib/__init__.py | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
2017-10-15 22:16:56 +00:00
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
2020-11-12 06:35:38 +00:00
index 1c47973f15..202acce525 100644
2017-10-15 22:16:56 +00:00
--- a/lib/matplotlib/__init__.py
+++ b/lib/matplotlib/__init__.py
2020-06-30 00:38:52 +00:00
@@ -536,33 +536,11 @@ def get_data_path(*, _from_rc=None):
2020-06-30 00:38:52 +00:00
@_logged_cached('(private) matplotlib data path: %s')
def _get_data_path():
2020-03-04 04:05:13 +00:00
- path = Path(__file__).with_name("mpl-data")
+ path = (Path(__file__).parent.parent.parent.parent.parent /
+ 'share/matplotlib/mpl-data')
if path.is_dir():
return str(path)
- cbook.warn_deprecated(
- "3.2", message="Matplotlib installs where the data is not in the "
- "mpl-data subdirectory of the package are deprecated since %(since)s "
- "and support for them will be removed %(removal)s.")
-
- def get_candidate_paths():
2019-05-31 05:44:54 +00:00
- # setuptools' namespace_packages may hijack this init file
2018-08-17 21:37:11 +00:00
- # so need to try something known to be in Matplotlib, not basemap.
- import matplotlib.afm
- yield Path(matplotlib.afm.__file__).with_name('mpl-data')
- # py2exe zips pure python, so still need special check.
- if getattr(sys, 'frozen', None):
- yield Path(sys.executable).with_name('mpl-data')
- # Try again assuming we need to step up one more directory.
- yield Path(sys.executable).parent.with_name('mpl-data')
- # Try again assuming sys.path[0] is a dir not a exe.
- yield Path(sys.path[0]) / 'mpl-data'
2020-03-04 04:05:13 +00:00
-
- for path in get_candidate_paths():
- if path.is_dir():
2020-03-18 07:28:30 +00:00
- defaultParams['datapath'][0] = str(path)
2020-03-04 04:05:13 +00:00
- return str(path)
-
raise RuntimeError('Could not find the matplotlib data files')
2018-08-17 21:37:11 +00:00
2020-06-30 00:38:52 +00:00
@@ -583,6 +561,7 @@ def matplotlib_fname():
2019-05-31 05:44:54 +00:00
is not defined)
- On other platforms,
2020-03-04 04:05:13 +00:00
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
2020-06-30 00:38:52 +00:00
+ - ``/etc/matplotlibrc``
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
exist.
"""
2020-06-30 00:38:52 +00:00
@@ -597,6 +576,7 @@ def matplotlib_fname():
2017-09-27 05:29:13 +00:00
yield matplotlibrc
yield os.path.join(matplotlibrc, 'matplotlibrc')
2018-08-17 21:37:11 +00:00
yield os.path.join(get_configdir(), 'matplotlibrc')
2017-09-27 05:29:13 +00:00
+ yield '/etc/matplotlibrc'
2020-06-30 00:38:52 +00:00
yield os.path.join(_get_data_path(), 'matplotlibrc')
2017-09-27 05:29:13 +00:00
for fname in gen_candidates():
2017-10-15 22:16:56 +00:00
--
2021-01-28 09:31:52 +00:00
2.29.2
2017-10-15 22:16:56 +00:00