mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
Bail out of setup if Numpy isn't available.
Also add requirements files.
This commit is contained in:
parent
f413e9db5e
commit
89280eb352
4
requirements-dev.txt
Normal file
4
requirements-dev.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Cython
|
||||
Numpy
|
||||
setuptools
|
||||
six
|
||||
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Numpy
|
||||
setuptools
|
||||
six
|
||||
70
setup.py
70
setup.py
@ -1,24 +1,21 @@
|
||||
import logging, subprocess, sys, os
|
||||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
# Have to do this after importing setuptools, which monkey patches distutils.
|
||||
from distutils.extension import Extension
|
||||
|
||||
logging.basicConfig()
|
||||
log = logging.getLogger()
|
||||
|
||||
version = '0.1'
|
||||
|
||||
# Use Cython if available.
|
||||
try:
|
||||
from Cython.Build import cythonize
|
||||
except ImportError:
|
||||
cythonize = None
|
||||
|
||||
logging.basicConfig()
|
||||
log = logging.getLogger()
|
||||
|
||||
version = '0.1'
|
||||
|
||||
# By default we'll try to get options via gdal-config. On systems without,
|
||||
# options will need to be set in setup.cfg or on the setup command line.
|
||||
include_dirs = []
|
||||
@ -26,6 +23,13 @@ library_dirs = []
|
||||
libraries = []
|
||||
extra_link_args = []
|
||||
|
||||
try:
|
||||
import numpy
|
||||
include_dirs.append(numpy.get_include())
|
||||
except ImportError:
|
||||
log.critical("Numpy and its headers are required to run setup(). Exiting.")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
gdal_config = "gdal-config"
|
||||
with open("gdal-config.txt", "w") as gcfg:
|
||||
@ -48,17 +52,12 @@ try:
|
||||
except Exception as e:
|
||||
log.warning("Failed to get options via gdal-config: %s", str(e))
|
||||
|
||||
import numpy
|
||||
include_dirs.append(numpy.get_include())
|
||||
|
||||
ext_options = dict(
|
||||
include_dirs=include_dirs,
|
||||
library_dirs=library_dirs,
|
||||
libraries=libraries,
|
||||
extra_link_args=extra_link_args)
|
||||
|
||||
print(ext_options)
|
||||
|
||||
# When building from a repo, Cython is required.
|
||||
if os.path.exists("MANIFEST.in"):
|
||||
log.info("MANIFEST.in found, presume a repo, cythonizing...")
|
||||
@ -77,28 +76,41 @@ else:
|
||||
Extension(
|
||||
'rasterio._io', ['rasterio/_io.c'], **ext_options)]
|
||||
|
||||
with open('README.md') as f:
|
||||
readme = f.read()
|
||||
|
||||
setup(name='rasterio',
|
||||
version=version,
|
||||
description="Reimagining GDAL raster access",
|
||||
long_description="""\
|
||||
""",
|
||||
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
description=(
|
||||
"Fast and direct raster I/O for Python programmers who use Numpy"),
|
||||
long_description=readme,
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: Information Technology',
|
||||
'Intended Audience :: Science/Research',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Programming Language :: C',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.0',
|
||||
'Programming Language :: Python :: 3.1',
|
||||
'Programming Language :: Python :: 3.2',
|
||||
'Programming Language :: Python :: 3.3',
|
||||
'Topic :: Multimedia :: Graphics :: Graphics Conversion',
|
||||
'Topic :: Scientific/Engineering :: GIS'
|
||||
],
|
||||
keywords='raster gdal',
|
||||
author='Sean Gillies',
|
||||
author_email='sean@mapbox.com',
|
||||
url='',
|
||||
url='https://github.com/sgillies/rasterio',
|
||||
license='BSD',
|
||||
# packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
|
||||
package_dir={'': '.'},
|
||||
packages=['rasterio'],
|
||||
include_package_data=True,
|
||||
ext_modules=ext_modules,
|
||||
zip_safe=False,
|
||||
install_requires=[
|
||||
# -*- Extra requirements: -*-
|
||||
],
|
||||
entry_points="""
|
||||
# -*- Entry points: -*-
|
||||
""",
|
||||
)
|
||||
'Numpy',
|
||||
'setuptools'
|
||||
])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user