X Tutup
Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ install:
# for obvci_appveyor_python_build_env.cmd
- cmd: conda install -c pelson/channel/development --yes --quiet obvious-ci
# for msinttypes and newer stuff
- cmd: conda config --add channels conda-forge
# conda-forge may serve outdated versions of certain packages (e.g. conda
# itself), so append it to the end of the list.
- cmd: conda config --append channels conda-forge
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The opposite is true as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Right now conda-forge is serving an outdated version of conda which is the reason the Appveyor build broke. I would hope that the official conda channel never serves an outdated version of conda... I don't think serving outdated versions of other build dependencies is as much of an issue (if any).
  2. I could instead set the channel_priority option documented at https://conda.io/docs/channels.html#managing-conda-channels, but there are other issues with that (see the link). I don't have a strong opinion though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conda-build 2.1.7 has now been released on conda-forge for windows py2.7.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this is not enough, I guess we also need a more recent version of conda itself (I guess what happens is that a recent conda-build exposes a bug in an old version of conda), see latest appveyor builds which fail with conda 4.2.13+conda-build 2.1.7 (vs my PR which uses 4.3.14/2.1.7)

- cmd: conda config --set show_channel_urls yes
- cmd: conda config --set always_yes true
# For building conda packages
Expand Down
61 changes: 20 additions & 41 deletions lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,26 +575,15 @@ def _create_tmp_config_dir():

Returns None if a writable temporary directory could not be created.
"""
import getpass
import tempfile
from matplotlib.cbook import mkdirs

try:
tempdir = tempfile.gettempdir()
except NotImplementedError:
# Some restricted platforms (such as Google App Engine) do not provide
# gettempdir.
return None
try:
username = getpass.getuser()
except KeyError:
username = str(os.getuid())

tempdir = tempfile.mkdtemp(prefix='matplotlib-%s-' % username, dir=tempdir)

os.environ['MPLCONFIGDIR'] = tempdir

return tempdir
configdir = os.environ['MPLCONFIGDIR'] = (
tempfile.mkdtemp(prefix='matplotlib-', dir=tempdir))
return configdir


get_home = verbose.wrap('$HOME=%s', _get_home, always=False)
Expand Down Expand Up @@ -805,34 +794,24 @@ def matplotlib_fname():
- Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a
system-defined copy.
"""
if six.PY2:
cwd = os.getcwdu()
else:
cwd = os.getcwd()
fname = os.path.join(cwd, 'matplotlibrc')
if os.path.exists(fname):
return fname

if 'MATPLOTLIBRC' in os.environ:
path = os.environ['MATPLOTLIBRC']
if os.path.exists(path):
if os.path.isfile(path):
return path
fname = os.path.join(path, 'matplotlibrc')
if os.path.exists(fname):
return fname

configdir = _get_configdir()
if os.path.exists(configdir):
fname = os.path.join(configdir, 'matplotlibrc')
if os.path.exists(fname):
return fname

path = get_data_path() # guaranteed to exist or raise
fname = os.path.join(path, 'matplotlibrc')
if not os.path.exists(fname):
warnings.warn('Could not find matplotlibrc; using defaults')

def gen_candidates():
yield os.path.join(six.moves.getcwd(), 'matplotlibrc')
try:
matplotlibrc = os.environ['MATPLOTLIBRC']
except KeyError:
pass
else:
yield matplotlibrc
yield os.path.join(matplotlibrc, 'matplotlibrc')
yield os.path.join(_get_configdir(), 'matplotlibrc')
yield os.path.join(get_data_path(), 'matplotlibrc')

for fname in gen_candidates():
if os.path.isfile(fname):
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
X Tutup