-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Replace most uses of getfilesystemencoding by os.fs{en,de}code. #10513
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.
Seems fine, though not sure about the mpl-data path stuff; would be nice to see more examples/tests of how that works.
lib/matplotlib/__init__.py
Outdated
if getattr(sys, 'frozen', None): | ||
yield sys.executable | ||
# Try again assuming we need to step up one more directory. | ||
yield os.path.dirname(sys.executable) |
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.
The logic seems wrong for the last two as in the original they did not have dirname
applied.
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.
They do (original: exe_path = sys.path.dirname(...)
). For the first one, the candidate will be
In [12]: Path(sys.executable).with_name("mpl-data")
Out[12]: PosixPath('/usr/bin/mpl-data')
In [13]: os.path.join(os.path.dirname(sys.executable), "mpl-data")
Out[13]: '/usr/bin/mpl-data'
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 do not think the logic on the lest entry is correct.
It gives
In [37]: Path(sys.path[0]).with_name('mpl-data')
Out[37]: PosixPath('/home/tcaswell/.virtualenvs/dd36/lib/python3.6/mpl-data')
where as the orginal gives
In [40]: os.path.join(sys.path[0], 'mpl-data')
Out[40]: '/home/tcaswell/.virtualenvs/dd36/lib/python3.6/site-packages/mpl-data'
Indeed, the last entry was off by 1. I redid the logic, should be fixed now. |
PR Summary
PR Checklist