Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLD: Install dependencies if cannot be imported. #300

Merged
merged 1 commit into from Sep 24, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions setup.py
Expand Up @@ -30,28 +30,30 @@
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
# (help on that would be awesome)
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
Expand All @@ -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,
Expand All @@ -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',
Expand Down