pyinstaller/pyinstaller-hooks-contrib

Hook for tzwhere (fork)

Closed this issue ยท 5 comments

Which library is the hook for?

tzwhere ...

... but I'm using this fork for currently unmerged

Have you gotten the library to work with pyinstaller?

No, I'm getting:

FileNotFoundError: [Errno 2] No such file or directory: '/workspaces/ng/dist/ng/_internal/tzwhere/tz_world.json.gz'

I tried:

binaries=[('/usr/local/python/3.12.2/lib/python3.12/site-packages/tzwhere/tz_world.json.gz', '_internal/tzwhere/')],

But same error.

Help / advice welcome!

What about:

binaries=[('/usr/local/python/3.12.2/lib/python3.12/site-packages/tzwhere/tz_world.json.gz', 'tzwhere')],

@bwoodsend yes! Thanks, needed one more and then it worked:

        ('/usr/local/python/3.12.2/lib/python3.12/site-packages/tzwhere/tz_world.json.gz', 'tzwhere'),
        ('/usr/local/python/3.12.2/lib/python3.12/site-packages/tzwhere/tz_world_shortcuts.json', 'tzwhere')

Happy to make a PR but skimming the docs I don't see:

  1. How to add reference to a binary (presumably in a site-packages location agnostic way), and:
  2. Guidance for requirements-test-libraries.txt when the package is broken upstream pending merging a fork pegler/pytzwhere#62

Thanks again ๐Ÿ™๐Ÿป

rokm commented
# hook-tzwhere.py
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('tzwhere')

You are not collecting binaries, but data files (not that the distinction matters that much with contemporary PyInstaller versions).

Guidance for requirements-test-libraries.txt when the package is broken upstream pending merging a fork pegler/pytzwhere#62

It doesn't really matter since the project seems too abandoned to ever release again. The tests only run when the version in the requirements-test-libraries.txt changes so if you put the latest version in now, CI will run on your pull request and fail although we can work around that by doing a one-shot run (see the collapsed section under CI/CD) where you give the https://github.com/domas-v/pytzwhere/archive/refs/heads/fix/numpy_version_compatibility.zip as the package name. After that though, unless pytzwhere comes back from the dead, the test will never run again.

To that end, I won't object if you skip the test+CI stuff.

rokm commented

To that end, I won't object if you skip the test+CI stuff.

Yeah, I agree. Maybe add an import test (or whatever is required to show that data files need to be collected), but do not add tzwhere to requirements file.