Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

would crash if get_home() returns None#2300

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdboom merged 1 commit intomatplotlib:v1.3.xfrommdboom:fix-get-home
Sep 30, 2013
Merged
Show file tree
Hide file tree
Changes fromall 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
50 changes: 33 additions & 17 deletionslib/matplotlib/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -532,7 +532,11 @@ def _get_xdg_config_dir():
base directory spec
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
"""
return os.environ.get('XDG_CONFIG_HOME', os.path.join(get_home(), '.config'))
home = get_home()
if home is None:
return None
else:
return os.environ.get('XDG_CONFIG_HOME', os.path.join(home, '.config'))


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


def _get_config_or_cache_dir(xdg_base):
Expand All@@ -557,22 +565,28 @@ def _get_config_or_cache_dir(xdg_base):
return _create_tmp_config_dir()
return configdir

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

if os.path.exists(p):
if not _is_writable_dir(p):
return _create_tmp_config_dir()
else:
try:
mkdirs(p)
except OSError:
return _create_tmp_config_dir()
if h is not None:
p = os.path.join(h, '.matplotlib')
if (sys.platform.startswith('linux') and
not os.path.exists(p) and
xdg_base is not None):
p = os.path.join(xdg_base, 'matplotlib')

if p is not None:
if os.path.exists(p):
if _is_writable_dir(p):
return p
else:
try:
mkdirs(p)
except OSError:
pass
else:
return p

returnp
return_create_tmp_config_dir()


def _get_configdir():
Expand DownExpand Up@@ -728,9 +742,11 @@ def matplotlib_fname():
if configdir is not None:
fname = os.path.join(configdir, 'matplotlibrc')
if os.path.exists(fname):
home = get_home()
if (sys.platform.startswith('linux') and
home is not None and
fname == os.path.join(
get_home(), '.matplotlib', 'matplotlibrc')):
home, '.matplotlib', 'matplotlibrc')):
warnings.warn(
"Found matplotlib configuration in ~/.matplotlib/. "
"To conform with the XDG base directory standard, "
Expand Down
4 changes: 2 additions & 2 deletionslib/matplotlib/font_manager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1324,15 +1324,15 @@ def findfont(prop, fontext='ttf'):
return result

else:
_fmcache = None

if not 'TRAVIS' in os.environ:
cachedir = get_cachedir()
if cachedir is not None:
if sys.version_info[0] >= 3:
_fmcache = os.path.join(cachedir, 'fontList.py3k.cache')
else:
_fmcache = os.path.join(cachedir, 'fontList.cache')
else:
_fmcache = None

fontManager = None

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp