blob: 2818cd6231328e28a4d713b343e3084c2ed21796 [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
James Kuszmaul58683ed2020-01-25 20:33:11 -08003@@ -110,6 +111,31 @@
Brian Silverman6470f442018-08-05 12:08:16 -07004 __version__ = str('1.4.2')
5 __version__numpy__ = str('1.6') # minimum required numpy version
6
James Kuszmaul58683ed2020-01-25 20:33:11 -08007+_matplotlib_base = os.path.join(os.path.dirname(os.path.dirname(__file__)), "..")
Brian Silverman6470f442018-08-05 12:08:16 -07008+
9+# Hack to point matplotlib at its data.
10+os.environ['MATPLOTLIBDATA'] = \
11+ os.path.join( \
Brian Silvermanb0ebf1d2018-10-17 23:36:40 -070012+ _matplotlib_base,
James Kuszmaul58683ed2020-01-25 20:33:11 -080013+ "usr", "share", "matplotlib", "mpl-data")
Brian Silverman6470f442018-08-05 12:08:16 -070014+# Avoid reading /etc/matplotlib in all cases. Matplotlib is pretty happy to
15+# escape the sandbox by using absolute paths.
16+os.environ['MATPLOTLIBRC'] = os.environ['MATPLOTLIBDATA']
17+# There's a bug where the temp directory gets set if MATPLOTLIBRC isn't set.
18+# That causes the directory to not be created in time. We set the variable
19+# manually here to work around the bug.
20+os.environ['MPLCONFIGDIR'] = '/tmp/matplotlib-nobody'
21+
Brian Silvermanb0ebf1d2018-10-17 23:36:40 -070022+# Tell Tcl where to find the sandboxed version. Otherwise, it will try using
23+# one from the host system, even if that's an incompatible version.
James Kuszmaul58683ed2020-01-25 20:33:11 -080024+os.environ['TCL_LIBRARY'] = os.path.join(_matplotlib_base, 'usr', 'share',
Brian Silvermanb0ebf1d2018-10-17 23:36:40 -070025+ 'tcltk', 'tcl8.6')
26+
James Kuszmaul58683ed2020-01-25 20:33:11 -080027+# Tell fontconfig where to find matplotlib's sandboxed font files.
Austin Schuh085eab92020-11-26 13:54:51 -080028+os.environ["FONTCONFIG_PATH"] = os.path.join(_matplotlib_base, "etc/fonts")
Austin Schuhcd1f7252021-09-24 21:11:43 -070029+os.environ["FONTCONFIG_FILE"] = "fonts.conf"
James Kuszmaul58683ed2020-01-25 20:33:11 -080030+os.environ["FONTCONFIG_SYSROOT"] = _matplotlib_base
31+
Brian Silverman6470f442018-08-05 12:08:16 -070032 try:
33 import dateutil
34 except ImportError: