|
1 |
| -import sys, glob, os, numpy, subprocess |
| 1 | +import sys, glob, os, subprocess |
| 2 | + |
2 | 3 | major, minor1, minor2, s, tmp = sys.version_info
|
3 | 4 | if major==2 and minor1<4 or major<2:
|
4 | 5 | raise SystemExit("""matplotlib and the basemap toolkit require Python 2.4 or later.""")
|
5 |
| -from numpy.distutils.core import setup, Extension |
| 6 | + |
| 7 | +from distutils.dist import Distribution |
6 | 8 | from distutils.util import convert_path
|
7 | 9 | from distutils import ccompiler, sysconfig
|
| 10 | + |
| 11 | +# Do not require numpy for just querying the package |
| 12 | +# Taken from the netcdf-python setup file (which took it from h5py setup file). |
| 13 | +inc_dirs = [] |
| 14 | +if any('--' + opt in sys.argv for opt in Distribution.display_option_names + |
| 15 | + ['help-commands', 'help']) or sys.argv[1] == 'egg_info': |
| 16 | + from distutils.core import setup, Extension |
| 17 | +else: |
| 18 | + import numpy |
| 19 | + # Use numpy versions if they are available. |
| 20 | + from numpy.distutils.core import setup, Extension |
| 21 | + # append numpy include dir. |
| 22 | + inc_dirs.append(numpy.get_include()) |
| 23 | + |
8 | 24 | try:
|
9 | 25 | from distutils.command.build_py import build_py_2to3 as build_py
|
10 | 26 | except ImportError:
|
@@ -62,7 +78,7 @@ def checkversion(GEOS_dir):
|
62 | 78 | manually and set the variable GEOS_dir (right after the line
|
63 | 79 | that says "set GEOS_dir manually here".""" % "', '".join(geos_search_locations))
|
64 | 80 | else:
|
65 |
| - geos_include_dirs=[os.path.join(GEOS_dir,'include'),numpy.get_include()] |
| 81 | + geos_include_dirs=[os.path.join(GEOS_dir,'include'),inc_dirs] |
66 | 82 | geos_library_dirs=[os.path.join(GEOS_dir,'lib'),os.path.join(GEOS_dir,'lib64')]
|
67 | 83 |
|
68 | 84 | # proj4 and geos extensions.
|
@@ -130,6 +146,7 @@ def checkversion(GEOS_dir):
|
130 | 146 | download_url = "https://downloads.sourceforge.net/project/matplotlib/matplotlib-toolkits/basemap-{0}/basemap-{0}.tar.gz".format(__version__),
|
131 | 147 | author = "Jeff Whitaker",
|
132 | 148 | author_email = "[email protected]",
|
| 149 | + install_requires = ["numpy>=1.2.1", "matplotlib>=1.0.0"], |
133 | 150 | platforms = ["any"],
|
134 | 151 | license = "OSI Approved",
|
135 | 152 | keywords = ["python","plotting","plots","graphs","charts","GIS","mapping","map projections","maps"],
|
|
0 commit comments