Skip to content

make pyshp optional #231

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

Closed
wants to merge 2 commits into from
Closed

make pyshp optional #231

wants to merge 2 commits into from

Conversation

jdkloe
Copy link

@jdkloe jdkloe commented Nov 28, 2015

here is my attempt to make pyshp optional. It introduces an environment variable PYSHP_dir that can be set to use an external copy of pyshp. If it is undefined the bundled version is used.
I could not find a "standard" method to do this in setup tools, so the changes in setup.py look somewhat like a workaround. It copies opt_lib/mpl_toolkits/basemap/shapefile.py to lib/mpl_toolkits/basemap/shapefile.py if the bundled version is to be used, then runs the setup function, and removes the file again after running this function.
Anyway, it seems to work correctly on my system, so if you think this is acceptable, you're welcome to merge in this pull request.

@micahcochran
Copy link
Contributor

I am glad that you are working on this. I think this patch is a little more complicated than it should be.

Here's what I'm thinking. setup.py needs to be modified to make pyshp and pyproj packages dependencies, so setuptools needs to be added. pyshp is really easy to install because it has no external dependencies. (pyproj has the C library PROJ.4 version 4.9 dependency.)

If you want to maintain backward compatibility for the internal shapefile.py you'd replace it with something like this:

from shapefile import *
raise DeprecationWarning ("please import shapefile package directly (since version 1.0.8)")

My setuptools skills are not yet up to the task.

@jdkloe
Copy link
Author

jdkloe commented Dec 1, 2015

Hi, thanks for looking at my pull request. I agree that it is somewhat ugly, and if a clean way is possible, then that should be preferred. I'm afraid I am not familiar enough with the differences between setuptools and distutils, at the moment to know how to do this cleanly. I'll try to study the details as soon as my time permits.

@jenshnielsen
Copy link
Member

Replaced by #234

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.

3 participants