"""
SunPy
=====

An open-source Python library for Solar Physics data analysis.

Web Links
---------
Homepage: http://sunpy.org
Documentation: http://docs.sunpy.org/en/stable/
"""
from __future__ import absolute_import

try:
    from .version import version as __version__
except ImportError:
    __version__ = ''

try:
    from .version import githash as __githash__
except ImportError:
    __githash__ = ''

try:
    _ASTROPY_SETUP_
except NameError:
    _ASTROPY_SETUP_ = False


if not _ASTROPY_SETUP_:
    import os
    from sunpy.util.config import load_config, print_config
    from sunpy.util import system_info
    from sunpy.tests.runner import SunPyTestRunner

    self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))

    # Load user configuration
    config = load_config()

    __all__ = ['config', 'self_test', 'system_info']

"""
SunPy
=====

An open-source Python library for Solar Physics data analysis.

Web Links
---------
Homepage: http://sunpy.org
Documentation: http://docs.sunpy.org/en/stable/
"""
from __future__ import absolute_import

try:
    from .version import version as __version__
except ImportError:
    __version__ = ''

try:
    from .version import githash as __githash__
except ImportError:
    __githash__ = ''

import os
from sunpy.util.config import load_config, print_config
from sunpy.util import system_info
from sunpy.tests.runner import SunPyTestRunner

self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))

# Load user configuration
config = load_config()

__all__ = ['config', 'self_test', 'system_info']

--- 
+++ 
@@ -21,14 +21,21 @@
 except ImportError:
     __githash__ = ''
 
-import os
-from sunpy.util.config import load_config, print_config
-from sunpy.util import system_info
-from sunpy.tests.runner import SunPyTestRunner
+try:
+    _ASTROPY_SETUP_
+except NameError:
+    _ASTROPY_SETUP_ = False
 
-self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))
 
-# Load user configuration
-config = load_config()
+if not _ASTROPY_SETUP_:
+    import os
+    from sunpy.util.config import load_config, print_config
+    from sunpy.util import system_info
+    from sunpy.tests.runner import SunPyTestRunner
 
-__all__ = ['config', 'self_test', 'system_info']
+    self_test = SunPyTestRunner.make_test_runner_in(os.path.dirname(__file__))
+
+    # Load user configuration
+    config = load_config()
+
+    __all__ = ['config', 'self_test', 'system_info']
Make sure package does not import itself during setup
