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

Appearance settings

Commit 9c77f6b

Browse filesBrowse files
authored
Merge pull request #21414 from anntzer/pt
FIX: Support pathological tmpdirs in TexManager.
2 parents 9716ee9 + e799ffb commit 9c77f6b
Copy full SHA for 9c77f6b

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed

‎lib/matplotlib/texmanager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/texmanager.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,19 @@ def make_dvi(self, tex, fontsize):
258258
basefile = self.get_basefile(tex, fontsize)
259259
dvifile = '%s.dvi' % basefile
260260
if not os.path.exists(dvifile):
261-
texfile = self.make_tex(tex, fontsize)
261+
texfile = Path(self.make_tex(tex, fontsize))
262262
# Generate the dvi in a temporary directory to avoid race
263263
# conditions e.g. if multiple processes try to process the same tex
264264
# string at the same time. Having tmpdir be a subdirectory of the
265265
# final output dir ensures that they are on the same filesystem,
266-
# and thus replace() works atomically.
266+
# and thus replace() works atomically. It also allows referring to
267+
# the texfile with a relative path (for pathological MPLCONFIGDIRs,
268+
# the absolute path may contain characters (e.g. ~) that TeX does
269+
# not support.)
267270
with TemporaryDirectory(dir=Path(dvifile).parent) as tmpdir:
268271
self._run_checked_subprocess(
269272
["latex", "-interaction=nonstopmode", "--halt-on-error",
270-
texfile], tex, cwd=tmpdir)
273+
f"../{texfile.name}"], tex, cwd=tmpdir)
271274
(Path(tmpdir) / Path(dvifile).name).replace(dvifile)
272275
return dvifile
273276

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.