Skip to content

Allow setting MATPLOTLIBRC by process substitution. #9570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
import os
import re
import shutil
import stat
import sys
import tempfile
import warnings
Expand Down Expand Up @@ -798,7 +799,8 @@ def matplotlib_fname():

- `$PWD/matplotlibrc`

- `$MATPLOTLIBRC` if it is a file
- `$MATPLOTLIBRC` if it is a file (or a named pipe, which can be created
e.g. by process substitution)

- `$MATPLOTLIBRC/matplotlibrc`

Expand Down Expand Up @@ -833,8 +835,10 @@ def gen_candidates():
yield os.path.join(get_data_path(), 'matplotlibrc')

for fname in gen_candidates():
if os.path.isfile(fname):
break
if os.path.exists(fname):
st_mode = os.stat(fname).st_mode
if stat.S_ISREG(st_mode) or stat.S_ISFIFO(st_mode):
break
# Return first candidate that is a file, or last candidate if none is
# valid (in that case, a warning is raised at startup by `rc_params`).
return fname
Expand Down