-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
FIX: skip sub directories when finding fonts on windows #22909
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
Conversation
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.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Thank you for working on this @Croadden The test failures are real and caused by these changes because win32FontDirectory uses some windows-only modules. This logic will have to be behind some platfrom gating. I suspect that 👍🏻 if sys.platfrom == 'win32' and ...: would be enough because Could you please also give the PR title and the commit messages more descriptive text (like "FIX: skip sub directories when finding fonts on windows") so that someone who is coming across this issue / commit in the future will have are very quick suggestion as to the motivation for the change. What files you changed and the actually changes is in the diff so the commit message is a chance for you to tell the future readers why you made this change! |
Damn, was pretty sure I saw OS check :( |
@tacaswell, I was pretty sure I used propper commit naming... Also I'm not able to rename commits without force pushing and rebasing, so maybe lets leave it as is for now? Lesson learnt. |
Oh, found it! I'm using github desktop and I eddited commit description, but not commit summary. So that's why commit messages is Update font_manager.py instead of add win32 fonts directory check and FIX: skip sub directories when finding fonts on windows |
lib/matplotlib/font_manager.py
Outdated
for filename in filenames | ||
if Path(filename).suffix.lower() in extensions] | ||
if sys.platform == 'win32' and directory == win32FontDirectory(): | ||
return [os.path.join(directory, filename) for filename in os.listdir(directory) if os.path.isfile(filename)] |
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.
I am very confused why this is not failing the linter as too long of a line.....
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.
Because we explicitly exclude font_manager.py from the line length check
Line 60 in 1ab4a53
lib/matplotlib/font_manager.py: E501 |
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.
I am very confused why this is not failing the linter as too long of a line.....
I'm running flake8 before each commit I make, so I think it's just ignored
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.
Oh, wrote previous comment before you replied to me :)
So should I fix it or not?
I'm glad you sorted it out! The summary (e.g. the first line) is very helpful when skimming the history. Unfortunately there is no way to update the commit message (which even though the UI shows it as two things is really just 1 block of text) is one of the values that git hashes to compute the SHA of the commit (which while annoying here, it means that someone can not change history without someone noticing!). As changing the message changes the SHA (and hence history) you have to force-push to publish the new commits. Again, git is trying to be helpful here and make sure that you do not accidentally delete history (think of the case where two people are working on the same branch. If both fetch the upstream branch, do some work and commit. The first person to push it works, the second person to push it fails (because if it did work it would effectively delete the commit from the first person). From git's point of view it can not tell "I change a commit and want to update it" from "two people are trying to push completely different work" so Sorry for the wall of text, hopefully it is more helpful than harmful. |
Your wall of the text help me so much, thanks! :) But I made a lot of mistakes here. Sorry for being bad, my git experience is so low (was using SVN only for more than 5 years) |
@Croadden may I fix it and force-push to your branch? |
@tacaswell Sure, no problem, it's just simple reformat |
@tacaswell as you go, you can include my suggestion above. |
Closes #22859 Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
Done! Steps I took:
|
Thanks! |
Thanks @Croadden! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again. |
Will do my best :) |
add win32 fonts directory check
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).