Merge pull request #688 from phargogh/bugfix/665-restrict-PATH-available-to-pyinstaller
Bugfix/665 restrict path available to pyinstaller
This commit is contained in:
commit
88536587f9
|
@ -79,11 +79,6 @@ jobs:
|
|||
- name: Build userguide, binaries, installer
|
||||
shell: bash -l {0}
|
||||
run: |
|
||||
# resolves ModuleNotFoundError during pyinstaller build on windows:
|
||||
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
|
||||
# If gdalXXX.dll is in the PATH, then set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable
|
||||
# to feed the PATH into os.add_dll_directory().
|
||||
export USE_PATH_FOR_GDAL_PYTHON=YES
|
||||
# This builds the users guide, binaries, and installer
|
||||
make windows_installer
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ Unreleased Changes
|
|||
* Minor changes to some other models' display names.
|
||||
* Update and expand on the instructions in the API docs for installing
|
||||
the ``natcap.invest`` package.
|
||||
* The InVEST binaries on Windows now no longer inspect the ``%PATH%``
|
||||
when looking for GDAL DLLs. This fixes an issue where InVEST would not
|
||||
launch on computers where the ``%PATH%`` either contained other
|
||||
environment variables or was malformed.
|
||||
* Seasonal Water Yield
|
||||
* Fixed a bug in validation where providing the monthly alpha table would
|
||||
cause a "Spatial file <monthly alpha table> has no projection" error.
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import os.path
|
||||
import glob
|
||||
|
||||
from PyInstaller.compat import is_win
|
||||
from PyInstaller.utils.hooks import collect_dynamic_libs, get_package_paths
|
||||
|
||||
if is_win:
|
||||
# GDAL appears to need `_gdal.cp38-win_amd64.pyd` located specifically in
|
||||
# `osgeo/_gdal....pyd` in order to work. This is because the GDAL python
|
||||
# __init__ script specifically looks in the `osgeo` directory in order to
|
||||
# find it. This is apparently only an issue on Windows.
|
||||
#
|
||||
# This will take the dynamic libraries in osgeo and put them into osgeo,
|
||||
# relative to the binaries directory.
|
||||
binaries = collect_dynamic_libs('osgeo', 'osgeo')
|
||||
pkg_base, pkg_dir = get_package_paths('osgeo')
|
||||
for pyd_file in glob.glob(os.path.join(pkg_dir, '*.pyd')):
|
||||
binaries.append((pyd_file, 'osgeo'))
|
|
@ -19,9 +19,3 @@ if platform.system() == 'Darwin':
|
|||
# sys._MEIPASS is the path to where the pyinstaller entrypoint bundle
|
||||
# lives. See the pyinstaller docs for more details.
|
||||
os.environ['SPATIALINDEX_C_LIBRARY'] = sys._MEIPASS
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
# On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.
|
||||
# If gdalXXX.dll is in the PATH, then set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable
|
||||
# to feed the PATH into os.add_dll_directory().
|
||||
os.environ['USE_PATH_FOR_GDAL_PYTHON'] = 'YES'
|
||||
|
|
Loading…
Reference in New Issue