-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python38/Windows dll load directory #852
Closed
Closed
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
761f724
initial add_dll_directory
rbuffat 7c8967e
remove empty line
rbuffat 69c95b5
search for gdal/bin in PATH, search for dll directories only when imp…
rbuffat 81de199
move del p
rbuffat a1a7f8c
add missing pathlib import
rbuffat efcd995
move del path
rbuffat 8a40a98
add python 3.8 / gdal 3.0.2 to build matrix, switch to stable gisinte…
rbuffat bb3f8d4
refactor import
rbuffat 4241697
remove python 3.8 constraint for finding dll directories
rbuffat 932bfa0
update documentation
rbuffat cdb4338
update documentation
rbuffat e475770
formatting
rbuffat ee46b23
add missing import
rbuffat 472a87d
refactor dll directory search and add
rbuffat bd97919
doc update
rbuffat 94588c7
bump appveyor gdal versions
rbuffat b608b2c
refactor to search for gdal*.dll
rbuffat 51bee20
add logging
rbuffat 19cf456
update readme
rbuffat d6d04ee
add gdal_home directory to logging message
rbuffat e94e7e1
add dlls using contextmanager
rbuffat 987bc99
move extension import test to _loading
rbuffat b1f7dbe
search in all directories in PATH for gdal libraries
rbuffat 3247c69
use add_gdal_dll_directories also for import of _geometry, _err
rbuffat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ | |
import os | ||
import sys | ||
import warnings | ||
|
||
import platform | ||
from six import string_types | ||
from collections import OrderedDict | ||
|
||
|
@@ -77,6 +77,17 @@ | |
class Path: | ||
pass | ||
|
||
|
||
# Add gdal dll directory on Windows and Python >= 3.8, see https://github.com/Toblerity/Fiona/issues/851 | ||
if platform.system() == 'Windows' and (3, 8) <= sys.version_info: | ||
|
||
# Add GDAL_HOME/bin, if present | ||
gdal_home = os.getenv('GDAL_HOME', None) | ||
|
||
if gdal_home is not None and os.path.exists(gdal_home): | ||
os.add_dll_directory(os.path.join(gdal_home, "bin")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If GDAL_HOME is set, but the directory does not exist, we should emit a warning |
||
|
||
|
||
# TODO: remove this? Or at least move it, flake8 complains. | ||
if sys.platform == "win32": | ||
libdir = os.path.join(os.path.dirname(__file__), ".libs") | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is add_dll_directory harmful when gdal dlls are already loaded? E.g. when multiple gdal binaries are present.