python-matplotlib/20_matplotlibrc_path_search...

37 lines
1.5 KiB
Diff

--- a/lib/matplotlib/__init__.py 2016-04-04 12:54:26.427194940 +0200
+++ b/lib/matplotlib/__init__.py 2016-04-04 12:56:12.662590255 +0200
@@ -682,9 +682,12 @@
_file = _decode_filesystem_path(__file__)
path = os.sep.join([os.path.dirname(_file), 'mpl-data'])
+ path = '/usr/share/matplotlib/mpl-data'
if os.path.isdir(path):
return path
+ raise RuntimeError('Could not find the matplotlib data files')
+
# setuptools' namespace_packages may highjack this init file
# so need to try something known to be in matplotlib, not basemap
import matplotlib.afm
@@ -812,7 +815,7 @@
home, '.matplotlib', 'matplotlibrc')
return fname
- path = get_data_path() # guaranteed to exist or raise
+ path = '/etc' # guaranteed to exist or raise
fname = os.path.join(path, 'matplotlibrc')
if not os.path.exists(fname):
warnings.warn('Could not find matplotlibrc; using defaults')
--- a/lib/matplotlib/cbook.py 2016-05-20 14:14:52.000000000 +0200
+++ b/lib/matplotlib/cbook.py 2016-05-20 19:28:57.373601582 +0200
@@ -823,8 +823,7 @@ def get_sample_data(fname, asfileobj=Tru
if matplotlib.rcParams['examples.directory']:
root = matplotlib.rcParams['examples.directory']
else:
- root = os.path.join(os.path.dirname(__file__),
- "mpl-data", "sample_data")
+ root = os.path.join(matplotlib._get_data_path(), 'sample_data')
path = os.path.join(root, fname)
if asfileobj: