Skip to content

Improve info logged by tex subsystem. #17258

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 1 commit into from
Apr 29, 2020
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Apr 28, 2020

  • Call kpsewhich in text mode (with the correct encoding).
  • Suppress empty stdout/stderr from logged outputs.

Together this changes the entries logged by dviread from

DEBUG:matplotlib.dviread:kpsewhich cmss10.tfm
DEBUG:matplotlib.dviread:stdout:
b'/usr/local/texlive/2019/texmf-dist/fonts/tfm/public/cm/cmss10.tfm\n'
DEBUG:matplotlib.dviread:stderr:
b''

to

DEBUG:matplotlib.dviread:kpsewhich cmss10.tfm
DEBUG:matplotlib.dviread:stdout:
/usr/local/texlive/2019/texmf-dist/fonts/tfm/public/cm/cmss10.tfm

  • Fix logged info about loading of tex fonts (it's the font that
    matters, not the font family).

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

- Call kpsewhich in text mode (with the correct encoding).
- Suppress empty stdout/stderr from logged outputs.

Together this changes the entries logged by dviread from
```
DEBUG:matplotlib.dviread:kpsewhich cmss10.tfm
DEBUG:matplotlib.dviread:stdout:
b'/usr/local/texlive/2019/texmf-dist/fonts/tfm/public/cm/cmss10.tfm\n'
DEBUG:matplotlib.dviread:stderr:
b''
```
to
```
DEBUG:matplotlib.dviread:kpsewhich cmss10.tfm
DEBUG:matplotlib.dviread:stdout:
/usr/local/texlive/2019/texmf-dist/fonts/tfm/public/cm/cmss10.tfm

```

- Fix logged info about loading of tex fonts (it's the font that
  matters, not the font family).
@@ -1079,10 +1082,7 @@ def find_tex_file(filename, format=None):
result = cbook._check_and_log_subprocess(cmd, _log, **kwargs)
except RuntimeError:
return ''
if os.name == 'nt':
return result.decode('utf-8').rstrip('\r\n')
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we have to strip the \r anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because passing an encoding also turns on newline conversion, per https://docs.python.org/3/library/subprocess.html#frequently-used-arguments.

@timhoffm timhoffm merged commit c7894e5 into matplotlib:master Apr 29, 2020
@anntzer anntzer deleted the texlog branch April 29, 2020 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants