Skip to content
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

Fixed #29484 -- Removed the need to specify SPATIALITE_LIBRARY_PATH with Spatialite 4.2+. #10017

Merged
merged 1 commit into from
Jun 9, 2018

Conversation

claudep
Copy link
Member

@claudep claudep commented Jun 1, 2018

@timgraham
Copy link
Member

It looks like an improvement (no need to specify 'mod_spatialite' on Ubuntu 16.04) but I don't think it'll work on 18.04 because the exception comes from conn.load_extension('mod_spatialite'). Also, I'm not sure if silently ignoring loading failures of settings.SPATIALITE_LIBRARY_PATH (in the case where one of the fallbacks works) is a good idea. I'll test later.

@timgraham
Copy link
Member

It works as I said in my comment. I wonder if we should instead drop support for SpatiaLite 4.1 (released June 2013) and replace find_library('spatialite') with mod_spatialite.so.

@claudep
Copy link
Member Author

claudep commented Jun 8, 2018

I don't think it hurts so much to keep find_library('spatialite') for now (maybe add a comment?).

@timgraham timgraham changed the title Fixed loading spatialite extension with Spatialite 4.2+ Fixed #29484 -- Removed the need to specify SPATIALITE_LIBRARY_PATH with Spatialite 4.2+. Jun 8, 2018
Copy link
Member

@timgraham timgraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not worried about silencing a failure to load from settings.SPATIALITE_LIBRARY_PATH in the case where one of the fallbacks works, then? If the performance penalty from calling load extension several times isn't a concern, I guess we can go with this. I would add mod_spatialite.so to the list since that fixes the issue on Ubuntu 18.04 and prioritize mod_spatialite variants over find_library().

'Unable to load the SpatiaLite library extension "%s"' % self.spatialite_lib
) from exc
'Unable to load the SpatiaLite library extension. '
'Library names tried: %s' % ", ".join(self.lib_spatialite_paths)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

', ' (since quotes)

for path in self.lib_spatialite_paths:
try:
conn.load_extension(path)
except Exception as exc:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unused as exc

@claudep
Copy link
Member Author

claudep commented Jun 8, 2018

And now?

@timgraham
Copy link
Member

Looks good. Worth trying try to add some tests?

@claudep
Copy link
Member Author

claudep commented Jun 8, 2018

I'm not very motivated to add tests here, this makes coverage happy, but I don't see a real value for it.

…ith Spatialite 4.2+.

Thanks Tim Graham for the review.
@claudep claudep closed this Jun 9, 2018
@claudep claudep deleted the spatialite-load branch June 9, 2018 07:26
@claudep claudep merged commit f383614 into django:master Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants