Skip to content

Commit

Permalink
Merge pull request #402 from ocefpaf/setuptools
Browse files Browse the repository at this point in the history
Setuptools
  • Loading branch information
WeatherGod authored May 2, 2018
2 parents 66aa458 + 60ed2aa commit decfa95
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
matplotlib>=1.0.0
numpy>=1.2.1
pyproj>=1.9.3
pyshp>=1.2.0
six
32 changes: 17 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
from __future__ import (absolute_import, division, print_function)

import sys, glob, os, subprocess
import glob
import io
import os
import sys
from setuptools.dist import Distribution

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

from distutils.dist import Distribution
from distutils.util import convert_path
from distutils import ccompiler, sysconfig

# Do not require numpy for just querying the package
# Taken from the netcdf-python setup file (which took it from h5py setup file).
inc_dirs = []
if any('--' + opt in sys.argv for opt in Distribution.display_option_names +
['help-commands', 'help']) or sys.argv[1] == 'egg_info':
from distutils.core import setup, Extension
from setuptools import setup, Extension
else:
import numpy
# Use numpy versions if they are available.
Expand All @@ -23,6 +23,14 @@
inc_dirs.append(numpy.get_include())


def get_install_requirements(path):
path = os.path.join(os.path.dirname(__file__), path)
with io.open(path, encoding='utf-8') as fp:
content = fp.read()
return [req for req in content.split("\n")
if req != '' and not req.startswith('#')]


def checkversion(GEOS_dir):
"""check geos C-API header file (geos_c.h)"""
try:
Expand Down Expand Up @@ -106,13 +114,7 @@ def checkversion(GEOS_dir):
datafiles = [os.path.join('data',os.path.basename(f)) for f in datafiles]
package_data = {'mpl_toolkits.basemap':datafiles}

requirements = [
"numpy>=1.2.1",
"matplotlib>=1.0.0",
"pyproj >= 1.9.3",
"pyshp >= 1.2.0",
"six",
]
install_requires = get_install_requirements("requirements.txt")

__version__ = "1.1.0"
setup(
Expand All @@ -130,7 +132,7 @@ def checkversion(GEOS_dir):
author_email = "[email protected]",
maintainer = "Ben Root",
maintainer_email = "[email protected]",
install_requires = requirements,
install_requires = install_requires,
platforms = ["any"],
license = "OSI Approved",
keywords = ["python","plotting","plots","graphs","charts","GIS","mapping","map projections","maps"],
Expand All @@ -145,6 +147,6 @@ def checkversion(GEOS_dir):
packages = packages,
namespace_packages = namespace_packages,
package_dir = package_dirs,
ext_modules = extensions,
ext_modules = extensions,
package_data = package_data
)

0 comments on commit decfa95

Please sign in to comment.