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

Add numpy as setup requirement #67

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 13 additions & 6 deletions setup.py
Expand Up @@ -11,15 +11,21 @@
except ImportError:
cythonize = None

include_dirs = []
try:

def get_numpy_include():
"""Helper function to find the numpy include path

The purpose of this function is to postpone importing numpy
until it is actually installed, so that the get_include()
method can be invoked.
"""
import numpy
yield numpy.get_include()

include_dirs.append(numpy.get_include())
except ImportError:
print("Numpy and its headers are required to run setup(). Exiting.")
sys.exit(1)

include_dirs = [
get_numpy_include()
]

# Parse the version from the fiona module.
with open("rio_color/__init__.py") as f:
Expand Down Expand Up @@ -90,6 +96,7 @@ def read(fname):
ext_modules=ext_modules,
include_dirs=include_dirs,
extras_require={"test": ["pytest", "colormath==2.0.2", "pytest-cov", "codecov"]},
setup_requires=["numpy"],
entry_points="""
[rasterio.rio_plugins]
color=rio_color.scripts.cli:color
Expand Down