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

Skip to content

Package initialization made possible when executed in environments with... #2719

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 13, 2014
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
27 changes: 14 additions & 13 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,12 @@ def _get_xdg_config_dir():
base directory spec
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
"""
home = get_home()
if home is None:
return None
else:
return os.environ.get('XDG_CONFIG_HOME', os.path.join(home, '.config'))
path = os.environ.get('XDG_CONFIG_HOME')
if path is None:
path = get_home()
if path is not None:
path = os.path.join(path, '.config')
return path


def _get_xdg_cache_dir():
Expand All @@ -544,11 +545,12 @@ def _get_xdg_cache_dir():
base directory spec
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
"""
home = get_home()
if home is None:
return None
else:
return os.environ.get('XDG_CACHE_HOME', os.path.join(home, '.cache'))
path = os.environ.get('XDG_CACHE_HOME')
if path is None:
path = get_home()
if path is not None:
path = os.path.join(path, '.cache')
return path


def _get_config_or_cache_dir(xdg_base):
Expand All @@ -568,9 +570,8 @@ def _get_config_or_cache_dir(xdg_base):
h = get_home()
if h is not None:
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 xdg_base):
p = os.path.join(xdg_base, 'matplotlib')

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