Skip to content

Commit

Permalink
hooks: pyproj: collect metadata for pyproj == 3.4.0
Browse files Browse the repository at this point in the history
In version 3.4.0, pyproj's `__init__.py` queries its own version
via `importlib.metadata.version(__package__)`, which requires the
package metadata to be collected. This change seems to have been
already reverted, so it will not affect subsequent pyproj releases.
  • Loading branch information
rokm committed Nov 7, 2022
1 parent 43bae9a commit 629bcbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/505.update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update ``pyproj`` hook for compatibility with ``pyproj`` v3.4.0.
2 changes: 1 addition & 1 deletion requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fabric==2.7.1
fiona==1.8.22; sys_platform != 'win32'
folium==0.13.0
ffpyplayer==4.3.5; python_version < '3.10' # doesn't have py310 wheels
geopandas==0.11.1; python_version >= '3.8' and sys_platform != 'win32'
geopandas==0.12.1; python_version >= '3.8' and sys_platform != 'win32'
python-gitlab==3.11.0
h5py==3.7.0; python_version >= '3.7'
humanize==4.4.0
Expand Down
7 changes: 6 additions & 1 deletion src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-pyproj.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import os
import sys
from PyInstaller.utils.hooks import collect_data_files, is_module_satisfies
from PyInstaller.utils.hooks import collect_data_files, is_module_satisfies, copy_metadata
from PyInstaller.compat import is_win


Expand Down Expand Up @@ -56,3 +56,8 @@
from PyInstaller.utils.hooks import logger
logger.warning("Datas for pyproj not found at:\n{}".format(src_proj_data))
# A runtime hook defines the path for `PROJ_LIB`

# With pyproj 3.4.0, we need to collect package's metadata due to `importlib.metadata.version(__package__)` call in
# `__init__.py`. This change was reverted in subsequent releases of pyproj, so we collect metadata only for 3.4.0.
if is_module_satisfies("pyproj == 3.4.0"):
datas += copy_metadata("pyproj")

0 comments on commit 629bcbf

Please sign in to comment.