@@ -469,56 +469,9 @@ def get_cachedir():
469
469
470
470
471
471
@_logged_cached ('matplotlib data path: %s' )
472
- def get_data_path (* , _from_rc = None ):
472
+ def get_data_path ():
473
473
"""Return the path to Matplotlib data."""
474
- if _from_rc is not None :
475
- _api .warn_deprecated (
476
- "3.2" ,
477
- message = ("Setting the datapath via matplotlibrc is deprecated "
478
- "%(since)s and will be removed %(removal)s." ),
479
- removal = '3.4' )
480
- path = Path (_from_rc )
481
- if path .is_dir ():
482
- return str (path )
483
- else :
484
- warnings .warn (f"You passed datapath: { _from_rc !r} in your "
485
- f"matplotribrc file ({ matplotlib_fname ()} ). "
486
- "However this path does not exist, falling back "
487
- "to standard paths." )
488
-
489
- return _get_data_path ()
490
-
491
-
492
- @_logged_cached ('(private) matplotlib data path: %s' )
493
- def _get_data_path ():
494
- path = Path (__file__ ).with_name ("mpl-data" )
495
- if path .is_dir ():
496
- return str (path )
497
-
498
- _api .warn_deprecated (
499
- "3.2" , message = "Matplotlib installs where the data is not in the "
500
- "mpl-data subdirectory of the package are deprecated since %(since)s "
501
- "and support for them will be removed %(removal)s." )
502
-
503
- def get_candidate_paths ():
504
- # setuptools' namespace_packages may hijack this init file
505
- # so need to try something known to be in Matplotlib, not basemap.
506
- import matplotlib .afm
507
- yield Path (matplotlib .afm .__file__ ).with_name ('mpl-data' )
508
- # py2exe zips pure python, so still need special check.
509
- if getattr (sys , 'frozen' , None ):
510
- yield Path (sys .executable ).with_name ('mpl-data' )
511
- # Try again assuming we need to step up one more directory.
512
- yield Path (sys .executable ).parent .with_name ('mpl-data' )
513
- # Try again assuming sys.path[0] is a dir not a exe.
514
- yield Path (sys .path [0 ]) / 'mpl-data'
515
-
516
- for path in get_candidate_paths ():
517
- if path .is_dir ():
518
- defaultParams ['datapath' ][0 ] = str (path )
519
- return str (path )
520
-
521
- raise RuntimeError ('Could not find the matplotlib data files' )
474
+ return str (Path (__file__ ).with_name ("mpl-data" ))
522
475
523
476
524
477
def matplotlib_fname ():
@@ -552,7 +505,7 @@ def gen_candidates():
552
505
yield matplotlibrc
553
506
yield os .path .join (matplotlibrc , 'matplotlibrc' )
554
507
yield os .path .join (get_configdir (), 'matplotlibrc' )
555
- yield os .path .join (_get_data_path (), 'matplotlibrc' )
508
+ yield os .path .join (get_data_path (), 'matplotlibrc' )
556
509
557
510
for fname in gen_candidates ():
558
511
if os .path .exists (fname ) and not os .path .isdir (fname ):
@@ -576,7 +529,6 @@ def gen_candidates():
576
529
# listed in the rcParams (not included in _all_deprecated).
577
530
# Values are tuples of (version,)
578
531
_deprecated_remain_as_none = {
579
- 'datapath' : ('3.2.1' ,),
580
532
'animation.avconv_path' : ('3.3' ,),
581
533
'animation.avconv_args' : ('3.3' ,),
582
534
'animation.html_args' : ('3.3' ,),
@@ -662,9 +614,6 @@ def __getitem__(self, key):
662
614
from matplotlib import pyplot as plt
663
615
plt .switch_backend (rcsetup ._auto_backend_sentinel )
664
616
665
- elif key == "datapath" :
666
- return get_data_path ()
667
-
668
617
return dict .__getitem__ (self , key )
669
618
670
619
def __repr__ (self ):
@@ -848,12 +797,6 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
848
797
with _api .suppress_matplotlib_deprecation_warning ():
849
798
config = RcParams ({** rcParamsDefault , ** config_from_file })
850
799
851
- with _api .suppress_matplotlib_deprecation_warning ():
852
- if config ['datapath' ] is None :
853
- config ['datapath' ] = _get_data_path ()
854
- else :
855
- config ['datapath' ] = get_data_path (_from_rc = config ['datapath' ])
856
-
857
800
if "" .join (config ['text.latex.preamble' ]):
858
801
_log .info ("""
859
802
*****************************************************************
0 commit comments