Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e325a96

Browse filesBrowse files
authored
Merge pull request #7195 from nbrunett/rm_matplotlibrc_check
remove check under linux for ~/.matplotlib
2 parents 7b27a1b + d667a49 commit e325a96
Copy full SHA for e325a96

File tree

Expand file treeCollapse file tree

2 files changed

+13
-28
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-28
lines changed

‎doc/faq/environment_variables_faq.rst

Copy file name to clipboardExpand all lines: doc/faq/environment_variables_faq.rst
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ Environment Variables
2525

2626
This is the directory used to store user customizations to matplotlib, as
2727
well as some caches to improve performance. If :envvar:`MPLCONFIGDIR` is not
28-
defined, :file:`{HOME}/.matplotlib` is used if it is writable.
29-
Otherwise, the python standard library :func:`tempfile.gettmpdir` is
30-
used to find a base directory in which the :file:`matplotlib`
31-
subdirectory is created.
28+
defined, :file:`{HOME}/.config/matplotlib` is generally used on unix-like
29+
systems and :file:`{HOME}/.matplotlib` is used on other platforms, if they are
30+
writable. Otherwise, the python standard library :func:`tempfile.gettempdir`
31+
is used to find a base directory in which the :file:`matplotlib` subdirectory
32+
is created.
3233

3334
.. envvar:: MPLBACKEND
3435

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+8-24Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.