Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8846e10

Browse files
committed
remove checking for ~/.matplotlib on linux
1 parent 8ff57bb commit 8846e10

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,10 @@ def _get_config_or_cache_dir(xdg_base):
639639
h = get_home()
640640
if h is not None:
641641
p = os.path.join(h, '.matplotlib')
642-
if (sys.platform.startswith('linux') and xdg_base):
643-
p = os.path.join(xdg_base, 'matplotlib')
642+
if sys.platform.startswith('linux'):
643+
p = None
644+
if xdg_base is not None:
645+
p = os.path.join(xdg_base, 'matplotlib')
644646

645647
if p is not None:
646648
if os.path.exists(p):
@@ -665,9 +667,8 @@ def _get_configdir():
665667
666668
1. If the MPLCONFIGDIR environment variable is supplied, choose that.
667669
668-
2a. On Linux, if `$HOME/.matplotlib` exists, choose that, but warn that
669-
that is the old location. Barring that, follow the XDG specification
670-
and look first in `$XDG_CONFIG_HOME`, if defined, or `$HOME/.config`.
670+
2a. On Linux, follow the XDG specification and look first in
671+
`$XDG_CONFIG_HOME`, if defined, or `$HOME/.config`.
671672
672673
2b. On other platforms, choose `$HOME/.matplotlib`.
673674
@@ -794,9 +795,7 @@ def matplotlib_fname():
794795
795796
- On Linux,
796797
797-
- `$HOME/.matplotlib/matplotlibrc`, if it exists
798-
799-
- or `$XDG_CONFIG_HOME/matplotlib/matplotlibrc` (if
798+
- `$XDG_CONFIG_HOME/matplotlib/matplotlibrc` (if
800799
$XDG_CONFIG_HOME is defined)
801800
802801
- or `$HOME/.config/matplotlib/matplotlibrc` (if
@@ -827,24 +826,9 @@ def matplotlib_fname():
827826
return fname
828827

829828
configdir = _get_configdir()
830-
if configdir is not None:
829+
if os.path.exists(configdir):
831830
fname = os.path.join(configdir, 'matplotlibrc')
832831
if os.path.exists(fname):
833-
home = get_home()
834-
if (sys.platform.startswith('linux') and
835-
home is not None and
836-
os.path.exists(os.path.join(
837-
home, '.matplotlib', 'matplotlibrc'))):
838-
warnings.warn(
839-
"Found matplotlib configuration in ~/.matplotlib/. "
840-
"To conform with the XDG base directory standard, "
841-
"this configuration location has been deprecated "
842-
"on Linux, and the new location is now %s/matplotlib/. "
843-
"Please move your configuration there to ensure that "
844-
"matplotlib will continue to find it in the future." %
845-
_get_xdg_config_dir())
846-
return os.path.join(
847-
home, '.matplotlib', 'matplotlibrc')
848832
return fname
849833

850834
path = get_data_path() # guaranteed to exist or raise

0 commit comments

Comments
 (0)