from distutils.core import setup

DESCRIPTION = "General tools for Astronomical Time Series in Python"
LONG_DESCRIPTION = """
gatspy: General tools for Astronomical Time Series in Python
============================================================

Gatspy (pronounced as F. Scott Fitzgerald might pronounce it) is a collection of tools for analyzing astronomical time series in Python.

For more information, visit http://github.com/astroml/gatspy/
"""
NAME = "gatspy"
AUTHOR = "Jake VanderPlas"
AUTHOR_EMAIL = "jakevdp@uw.edu"
MAINTAINER = "Jake VanderPlas"
MAINTAINER_EMAIL = "jakevdp@uw.edu"
URL = 'http://github.com/astroml/gatspy'
DOWNLOAD_URL = 'http://github.com/astroml/gatspy'
LICENSE = 'BSD 3-clause'

import gatspy
VERSION = gatspy.__version__

setup(name=NAME,
      version=VERSION,
      description=DESCRIPTION,
      long_description=LONG_DESCRIPTION,
      author=AUTHOR,
      author_email=AUTHOR_EMAIL,
      maintainer=MAINTAINER,
      maintainer_email=MAINTAINER_EMAIL,
      url=URL,
      download_url=DOWNLOAD_URL,
      license=LICENSE,
      packages=['gatspy',
                'gatspy.tests',
                'gatspy.periodic',
                'gatspy.periodic.tests',
                'gatspy.datasets',
                'gatspy.datasets.tests',
            ],
      classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: BSD License',
        'Natural Language :: English',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4'],
     )

@@ -1,8 +1,39 @@
+import io%0Aimport os%0Aimport re%0A%0A
 from dis
@@ -58,16 +58,472 @@
  setup%0A%0A
+%0Adef read(path, encoding='utf-8'):%0A    path = os.path.join(os.path.dirname(__file__), path)%0A    with io.open(path, encoding=encoding) as fp:%0A        return fp.read()%0A%0A%0Adef version(path):%0A    version_file = read(path)%0A    version_match = re.search(r%22%22%22%5E__version__ = %5B'%22%5D(%5B%5E'%22%5D*)%5B'%22%5D%22%22%22,%0A                              version_file, re.M)%0A    if version_match:%0A        return version_match.group(1)%0A    raise RuntimeError(%22Unable to find version string.%22)%0A%0A%0A
 DESCRIPT
@@ -1196,22 +1196,8 @@
 e'%0A%0A
-import gatspy%0A
 VERS
@@ -1206,26 +1206,37 @@
 N = 
+version('
 gatspy
-.__version__
+/__init__.py')
 %0A%0Ase

Fix ImportError when gatspy is installed as a dependency