-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fix for latex call on PS backend (Issue #5895) #5928
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1452,6 +1452,10 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble, | |
# multiple | ||
if sys.platform == 'win32': precmd = '%s &&'% os.path.splitdrive(tmpdir)[0] | ||
else: precmd = '' | ||
#Replace \\ for / so latex does not think there is a function call | ||
latexfile = latexfile.replace("\\", "/") | ||
# Replace ~ so Latex does not think it is line break | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment is for the wrong line now. |
||
latexfile = latexfile.replace("~", "\\string~") | ||
command = '%s cd "%s" && latex -interaction=nonstopmode "%s" > "%s"'\ | ||
%(precmd, tmpdir, latexfile, outfile) | ||
verbose.report(command, 'debug') | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a fix to on unrelated problem to the one reported in #5923 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand the latex stuff, it is needed because otherwise the next line would be interpreted as introducing a new directory "break":
c:\something\short~1\tempfile
->c:/something/short~1/tempfile
->c:/something/short\\string~1/tempfile
Without the first step, the dirs would read
c: - something - short - string~1 - tempfile
.@Grillard can you confirm that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So has the ps backend just always been broken on windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No: you can also specify all slashes as backlashes: the name is passed to a program and either used as filename with backlashes but no ~ allowed (is probably internally converted to forwards slashes) or as a latex input with
/
as path separator which can contain\string~
but no backlashes.-> It was only broken when you use a short name as tempfile which contains
~
because latex has that as a special character which needs to be escaped.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will probably be also broken on unix, if you add a testcase where you set
TMP
,TMPDIR
andTEMP
(whatever mkstemp used first is probably enough) to a path with a~
in it. As far as I know, these are valid filenames on unix?!Would probably enough to do that in the ps tests by simply adding a testcase which sets that in
os.environ
before doing the mpl calls...