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 8a8c881

Browse filesBrowse files
authored
Merge pull request #11854 from anntzer/matplotlibrcdevnull
Accept anything that's not a directory for $MATPLOTLIBRC.
2 parents b9b02f1 + 71326f5 commit 8a8c881
Copy full SHA for 8a8c881

File tree

Expand file treeCollapse file tree

2 files changed

+14
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-7
lines changed
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:orphan:
2+
3+
The MATPLOTLIBRC environment variable can now point to any "file" path
4+
``````````````````````````````````````````````````````````````````````
5+
6+
This includes device files; in particular, on Unix systems, one can set
7+
``MATPLOTLIBRC`` to ``/dev/null`` to ignore the user's matplotlibrc file and
8+
fall back to Matplotlib's defaults.
9+
10+
As a reminder, if ``MATPLOTLIBRC`` points to a directory, Matplotlib will try
11+
to load the matplotlibrc file from ``$MATPLOTLIBRC/matplotlibrc``.

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@
130130
import pprint
131131
import re
132132
import shutil
133-
import stat
134133
import subprocess
135134
import tempfile
136135
import urllib.request
@@ -708,8 +707,7 @@ def matplotlib_fname():
708707
709708
- `$PWD/matplotlibrc`
710709
711-
- `$MATPLOTLIBRC` if it is a file (or a named pipe, which can be created
712-
e.g. by process substitution)
710+
- `$MATPLOTLIBRC` if it is not a directory
713711
714712
- `$MATPLOTLIBRC/matplotlibrc`
715713
@@ -744,10 +742,8 @@ def gen_candidates():
744742
yield os.path.join(get_data_path(), 'matplotlibrc')
745743

746744
for fname in gen_candidates():
747-
if os.path.exists(fname):
748-
st_mode = os.stat(fname).st_mode
749-
if stat.S_ISREG(st_mode) or stat.S_ISFIFO(st_mode):
750-
break
745+
if os.path.exists(fname) and not os.path.isdir(fname):
746+
break
751747
# Return first candidate that is a file, or last candidate if none is
752748
# valid (in that case, a warning is raised at startup by `rc_params`).
753749
return fname

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.