Skip to content

Commit

Permalink
Improve osgeo hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Eggert Magnusson authored and Eggert Magnusson committed Jan 22, 2024
1 parent dff7526 commit 1bbef22
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/693.update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix hook for ``osgeo``, to include proj data files.
4 changes: 2 additions & 2 deletions src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-osgeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

# Auxiliary data:
#
# - general case (data in 'osgeo/data/gdal'):
datas = collect_data_files('osgeo', subdir=os.path.join('data', 'gdal'))
# - general case (data in 'osgeo/data'):
datas = collect_data_files('osgeo', subdir='data')

# check if the data has been effectively found in 'osgeo/data/gdal'
if len(datas) == 0:
Expand Down
9 changes: 9 additions & 0 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1895,3 +1895,12 @@ def test_pypylon(pyi_builder):
pyi_builder.test_source("""
from pypylon import pylon
""")

@importorskip('osgeo')
def test_osgeo(pyi_builder):
pyi_builder.test_source("""
from osgeo import osr
sr = osr.SpatialReference()
sr.ImportFromEPSG(4326)
assert(sr.EPSGTreatsAsLatLong())
""")

0 comments on commit 1bbef22

Please sign in to comment.