From 8c38c46f47d425a08b72f1504e926c57cdc9256b Mon Sep 17 00:00:00 2001 From: Skipper Seabold Date: Wed, 24 Sep 2014 15:28:53 -0400 Subject: [PATCH] BLD: Install dependencies if cannot be imported. --- setup.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 5be00d4be3..60b0b7bb65 100644 --- a/setup.py +++ b/setup.py @@ -30,8 +30,8 @@ except ImportError: from distutils.core import setup - def check_dependencies(): + install_requires = [] # Just make sure dependencies exist, I haven't rigorously # tested what the minimal versions that will work are @@ -39,19 +39,21 @@ def check_dependencies(): try: import numpy except ImportError: - raise ImportError("seaborn requires numpy") + install_requires.append('numpy') try: import scipy except ImportError: - raise ImportError("seaborn requires scipy") + install_requires.append('scipy') try: import matplotlib except ImportError: - raise ImportError("seaborn requires matplotlib") + install_requires.append('matplotlib') try: import pandas except ImportError: - raise ImportError("seaborn requires pandas") + install_requires.append('pandas') + + return install_requires if __name__ == "__main__": import os @@ -62,7 +64,9 @@ def check_dependencies(): if not (len(sys.argv) >= 2 and ('--help' in sys.argv[1:] or sys.argv[1] in ('--help-commands', 'egg_info', '--version', 'clean'))): - check_dependencies() + install_requires = check_dependencies() + else: + install_requires = [] setup(name=DISTNAME, maintainer=MAINTAINER, @@ -73,6 +77,7 @@ def check_dependencies(): url=URL, version=VERSION, download_url=DOWNLOAD_URL, + install_requires=install_requires, packages=['seaborn', 'seaborn.external', 'seaborn.tests'], classifiers=[ 'Intended Audience :: Science/Research',