davidhamann/python-fmrest

Compatibility with PyInstaller - Add hook file.

Closed this issue · 1 comments

PyInstaller gets confused when trying to generate an executable for my project because of the python-fmrest package. It doesn't include the python-fmrest metadata, likely because the top-level import module name is different ("fmrest" instead of "python-fmrest").

The fix for this is to include a pyuinstaller hook to tell pyinstaller to copy the package's metadata. I"ve made my own for my project, but it's best if it's included in your source.

A single file with the name "hook-fmrest.py" with the following content will do the trick.

from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('python-fmrest')

Then you need to include information in "setup.cfg" to point pyinstaller to the hook file. See pyinstaller's docs for reference:
https://pyinstaller.readthedocs.io/en/stable/hooks.html#provide-hooks-with-package

For now, I added a section on how to create a custom hook file to the README as per 1a9c4e8. Will have a look into including the hook as part of the package, but would first need to test out that it is successfully picked up in the bundling process. Feel free to submit a PR if you have tested this already.