From ce9442cc91730d6458ef43b6e4b75fa89c7d8f13 Mon Sep 17 00:00:00 2001
From: David Rafferty <drafferty@hs.uni-hamburg.de>
Date: Fri, 4 May 2018 10:29:21 +0200
Subject: [PATCH] Adjust astropy dependency depending on Python version (issue
 #12)

---
 setup.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/setup.py b/setup.py
index 236c405..e49c2b5 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,7 @@
 from __future__ import print_function
 from setuptools import setup, Command
 import os
+import sys
 import lsmtool._version
 
 
@@ -24,6 +25,11 @@ class PyTest(Command):
         errno = subprocess.call([sys.executable, 'runtests.py'])
         raise SystemExit(errno)
 
+# Handle Python 3-only dependencies
+if sys.version_info < (3, 0):
+    reqlist = ['numpy','astropy >= 0.4, <3.0']
+else:
+    reqlist = ['numpy','astropy >= 0.4']
 
 setup(
     name='lsmtool',
@@ -34,7 +40,7 @@ setup(
     description=description,
     long_description=long_description,
     platforms='any',
-    classifiers = [
+    classifiers=[
         'Programming Language :: Python',
         'Development Status :: 4 - Beta',
         'Natural Language :: English',
@@ -43,9 +49,9 @@ setup(
         'Topic :: Scientific/Engineering :: Astronomy',
         'Topic :: Software Development :: Libraries :: Python Modules',
         ],
-    install_requires=['numpy','astropy >= 0.4'],
-    scripts = ['bin/lsmtool'],
+    install_requires=reqlist,
+    scripts=['bin/lsmtool'],
     packages=['lsmtool','lsmtool.operations'],
-    setup_requires = ['pytest-runner'],
-    tests_require = ['pytest']
+    setup_requires=['pytest-runner'],
+    tests_require=['pytest']
     )
-- 
GitLab