8000 _get_xdg_config_dir(), _get_xdg_cache_dir() - Restored for conformity to the standard. by michs · Pull Request #2692 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

_get_xdg_config_dir(), _get_xdg_cache_dir() - Restored for conformity to the standard. #2692

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
_get_config_or_cache_dir() - behaviour according specification in _ge…
…t_configdir() restored.

1. If an old config $HOME/.matplotlib exists it should be chosen also on Linux.

2. However, if the old config does not exist and xdg_home is None (can be the case in cluster environments) -> do not try to create directory in the non-existing home directory rather in the temporary directory.
  • Loading branch information
Michael committed Dec 22, 2013
commit 7da7e6056fe8c227e04708384a694da14aa8d21a
13 changes: 8 additions & 5 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,13 +568,16 @@ def _get_config_or_cache_dir(xdg_base):

p = None
h = get_home()
if h is not None:
if h:
p = os.path.join(h, '.matplotlib')
if (sys.platform.startswith('linux') and
xdg_base is not None):
p = os.path.join(xdg_base, 'matplotlib')
if sys.platform.startswith('linux') and not os.path.exists(p):
# no old config exists
if xdg_base:
p = os.path.join(xdg_base, 'matplotlib')
else:
p = None

if p is not None:
if p:
if os.path.exists(p):
if _is_writable_dir(p):
return p
Expand Down
0