Repository: pyinstaller/pyinstaller

Issue:
Support matplotlib-3.4.0rc1
## Description of the issue
`matplotlib._get_data_path` no longer exists since 3.4.0rc1: https://github.com/matplotlib/matplotlib/commit/e1352c71f07aee7eab004b73dd9bda2a260ab31b.
This is on schedule for the removal of the deprecations that occurred around the time of #5006. The missing function leads to a traceback output during build, and the whole `cwd` being crammed into `mpl-data`. Finally, `matplotlib` cannot be imported in the packaged app because it cannot find `mpl-data/matplotlibrc`.
## Context information (for bug reports)

* Output of `pyinstaller --version`: ```4.2```
* Version of Python: `3.8`
* Platform: `Windows`
* Did you also try this on another platform? Does it work there? `Surely it is a cross platform bug`


> * try the latest development version, using the following command: 
> 
> ```shell
> pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
> ```
> 
> * follow *all* the instructions in our "If Things Go Wrong" Guide
>   (https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and
> 
> ### Make sure [everything is packaged correctly](https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#make-sure-everything-is-packaged-correctly)
> 
>   * [ ] start with clean installation
>   * [ ] use the latest development version
>   * [ ] Run your frozen program **from a command window (shell)** — instead of double-clicking on it
>   * [ ] Package your program in **--onedir mode**
>   * [ ] Package **without UPX**, say: use the option `--noupx` or set `upx=False` in your .spec-file
>   * [ ] Repackage you application in **verbose/debug mode**. For this, pass the option `--debug` to `pyi-makespec` or `pyinstaller` or use `EXE(..., debug=1, ...)` in your .spec file.
> 
This part of the template is irrelevant, as the responsible code is unchanged on `develop`

### A minimal example program which shows the error

```
pip install --pre matplotlib==3.4.0rc1 pyinstaller
echo "import matplotlib" > test.py
pyinstaller test.py
```

### Stacktrace / full error message
Building `pyinstaller test.py`:
```
20391 INFO: Loading module hook 'hook-matplotlib.py' from 'XXXXXXX'...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: module 'matplotlib' has no attribute '_get_data_path'

```
Running `test.exe`:
```
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import matplotlib
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 531, in exec_module
  File "matplotlib\__init__.py", line 820, in <module>
  File "matplotlib\__init__.py", line 725, in _rc_params_in_file
  File "contextlib.py", line 113, in __enter__
  File "matplotlib\__init__.py", line 703, in _open_file_or_url
FileNotFoundError: [Errno 2] No such file or directory: 'xxxxx\\matplotlib\\mpl-data\\matplotlibrc'
[2688] Failed to execute script test

```

## Possible resolution

Simply remove the first underscore in `matplotlib._get_data_path` in 

https://github.com/pyinstaller/pyinstaller/blob/b9fcbbf86bc71addafc830debe289e7edb2a5697/PyInstaller/hooks/hook-matplotlib.py#L16

This works on my system.

I'm a little confused as to why the private function was being used in the first place. `matplotlib.get_data_path` has been available for some time.


Discussion:

Resolving patch:
diff --git a/PyInstaller/hooks/hook-matplotlib.py b/PyInstaller/hooks/hook-matplotlib.py
--- a/PyInstaller/hooks/hook-matplotlib.py
+++ b/PyInstaller/hooks/hook-matplotlib.py
@@ -13,7 +13,7 @@
 from PyInstaller.utils.hooks import exec_statement
 
 mpl_data_dir = exec_statement(
-    "import matplotlib; print(matplotlib._get_data_path())")
+    "import matplotlib; print(matplotlib.get_data_path())")
 
 datas = [
     (mpl_data_dir, "matplotlib/mpl-data"),


Test patch: