blob: 11a3ad85c0296f4cab44c7a0410cc7702f7ec416 [file] [log] [blame]
Brian Silverman6470f442018-08-05 12:08:16 -07001--- a/__init__.py 2018-07-11 15:57:58.086509489 -0700
2+++ b/__init__.py 2018-07-11 16:04:15.004795500 -0700
3@@ -102,6 +102,7 @@
4 from __future__ import (absolute_import, division, print_function,
5 unicode_literals)
6
7+import os
8 import six
9 import sys
10 import distutils.version
11@@ -110,6 +111,21 @@
12 __version__ = str('1.4.2')
13 __version__numpy__ = str('1.6') # minimum required numpy version
14
15+matplotlib_base = os.path.dirname(os.path.dirname(__file__))
16+
17+# Hack to point matplotlib at its data.
18+os.environ['MATPLOTLIBDATA'] = \
19+ os.path.join( \
20+ matplotlib_base,
21+ "usr", "share", "matplotlib", "mpl-data")
22+# Avoid reading /etc/matplotlib in all cases. Matplotlib is pretty happy to
23+# escape the sandbox by using absolute paths.
24+os.environ['MATPLOTLIBRC'] = os.environ['MATPLOTLIBDATA']
25+# There's a bug where the temp directory gets set if MATPLOTLIBRC isn't set.
26+# That causes the directory to not be created in time. We set the variable
27+# manually here to work around the bug.
28+os.environ['MPLCONFIGDIR'] = '/tmp/matplotlib-nobody'
29+
30 try:
31 import dateutil
32 except ImportError: