Skip to content

Commit decfa95

Browse files
authoredMay 2, 2018
Merge pull request #402 from ocefpaf/setuptools
Setuptools
2 parents 66aa458 + 60ed2aa commit decfa95

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed
 

‎requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
matplotlib>=1.0.0
2+
numpy>=1.2.1
13
pyproj>=1.9.3
24
pyshp>=1.2.0
35
six

‎setup.py

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
from __future__ import (absolute_import, division, print_function)
22

3-
import sys, glob, os, subprocess
3+
import glob
4+
import io
5+
import os
6+
import sys
7+
from setuptools.dist import Distribution
48

59
if sys.version_info < (2, 6):
610
raise SystemExit("""matplotlib and the basemap toolkit require Python 2.6 or later.""")
711

8-
from distutils.dist import Distribution
9-
from distutils.util import convert_path
10-
from distutils import ccompiler, sysconfig
11-
1212
# Do not require numpy for just querying the package
1313
# Taken from the netcdf-python setup file (which took it from h5py setup file).
1414
inc_dirs = []
1515
if any('--' + opt in sys.argv for opt in Distribution.display_option_names +
1616
['help-commands', 'help']) or sys.argv[1] == 'egg_info':
17-
from distutils.core import setup, Extension
17+
from setuptools import setup, Extension
1818
else:
1919
import numpy
2020
# Use numpy versions if they are available.
@@ -23,6 +23,14 @@
2323
inc_dirs.append(numpy.get_include())
2424

2525

26+
def get_install_requirements(path):
27+
path = os.path.join(os.path.dirname(__file__), path)
28+
with io.open(path, encoding='utf-8') as fp:
29+
content = fp.read()
30+
return [req for req in content.split("\n")
31+
if req != '' and not req.startswith('#')]
32+
33+
2634
def checkversion(GEOS_dir):
2735
"""check geos C-API header file (geos_c.h)"""
2836
try:
@@ -106,13 +114,7 @@ def checkversion(GEOS_dir):
106114
datafiles = [os.path.join('data',os.path.basename(f)) for f in datafiles]
107115
package_data = {'mpl_toolkits.basemap':datafiles}
108116

109-
requirements = [
110-
"numpy>=1.2.1",
111-
"matplotlib>=1.0.0",
112-
"pyproj >= 1.9.3",
113-
"pyshp >= 1.2.0",
114-
"six",
115-
]
117+
install_requires = get_install_requirements("requirements.txt")
116118

117119
__version__ = "1.1.0"
118120
setup(
@@ -130,7 +132,7 @@ def checkversion(GEOS_dir):
130132
author_email = "jeffrey.s.whitaker@noaa.gov",
131133
maintainer = "Ben Root",
132134
maintainer_email = "ben.v.root@gmail.com",
133-
install_requires = requirements,
135+
install_requires = install_requires,
134136
platforms = ["any"],
135137
license = "OSI Approved",
136138
keywords = ["python","plotting","plots","graphs","charts","GIS","mapping","map projections","maps"],
@@ -145,6 +147,6 @@ def checkversion(GEOS_dir):
145147
packages = packages,
146148
namespace_packages = namespace_packages,
147149
package_dir = package_dirs,
148-
ext_modules = extensions,
150+
ext_modules = extensions,
149151
package_data = package_data
150152
)

0 commit comments

Comments
 (0)
Please sign in to comment.