70 lines
2.7 KiB
Diff
70 lines
2.7 KiB
Diff
From 9dc36f4d7c7c63c7a38aea73c4c25b0e54c44573 Mon Sep 17 00:00:00 2001
|
|
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
|
Date: Wed, 27 Sep 2017 19:35:59 -0400
|
|
Subject: [PATCH 1/3] matplotlibrc path search fix
|
|
|
|
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
|
---
|
|
lib/matplotlib/__init__.py | 28 ++++------------------------
|
|
1 file changed, 4 insertions(+), 24 deletions(-)
|
|
|
|
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py
|
|
index c425fe818..409217f6b 100644
|
|
--- a/lib/matplotlib/__init__.py
|
|
+++ b/lib/matplotlib/__init__.py
|
|
@@ -536,33 +536,11 @@ def get_data_path(*, _from_rc=None):
|
|
|
|
@_logged_cached('(private) matplotlib data path: %s')
|
|
def _get_data_path():
|
|
- 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():
|
|
- # setuptools' namespace_packages may hijack this init file
|
|
- # 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'
|
|
-
|
|
- for path in get_candidate_paths():
|
|
- if path.is_dir():
|
|
- defaultParams['datapath'][0] = str(path)
|
|
- return str(path)
|
|
-
|
|
raise RuntimeError('Could not find the matplotlib data files')
|
|
|
|
|
|
@@ -583,6 +561,7 @@ def matplotlib_fname():
|
|
is not defined)
|
|
- On other platforms,
|
|
- ``$HOME/.matplotlib/matplotlibrc`` if ``$HOME`` is defined
|
|
+ - ``/etc/matplotlibrc``
|
|
- Lastly, it looks in ``$MATPLOTLIBDATA/matplotlibrc``, which should always
|
|
exist.
|
|
"""
|
|
@@ -597,6 +576,7 @@ def matplotlib_fname():
|
|
yield matplotlibrc
|
|
yield os.path.join(matplotlibrc, 'matplotlibrc')
|
|
yield os.path.join(get_configdir(), 'matplotlibrc')
|
|
+ yield '/etc/matplotlibrc'
|
|
yield os.path.join(_get_data_path(), 'matplotlibrc')
|
|
|
|
for fname in gen_candidates():
|
|
--
|
|
2.25.4
|
|
|