Skip to content

Commit

Permalink
hooks: matplotlib: assert that mpl_data_dir is not empty
Browse files Browse the repository at this point in the history
If the statement in exec_statement() fails for whatever reason,
mpl_data_dir ends up empty, which in turn cases the current working
directory being collected as matplotlib/mpl-data.

This leads to difficult-to-debug issues (see confusion around .git
directory under #5504), so it's better to just signal the error.
  • Loading branch information
rokm committed Mar 12, 2021
1 parent 81b0c1b commit dabd9d7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions PyInstaller/hooks/hook-matplotlib.py
Expand Up @@ -14,6 +14,7 @@

mpl_data_dir = exec_statement(
"import matplotlib; print(matplotlib.get_data_path())")
assert mpl_data_dir, "Failed to determine matplotlib's data directory!"

datas = [
(mpl_data_dir, "matplotlib/mpl-data"),
Expand Down

0 comments on commit dabd9d7

Please sign in to comment.