From 712d29e565d37e9fe590df15fb052d02f655c0ee Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 8 Feb 2019 12:22:55 +0000 Subject: [PATCH] Add a comment about the _ASTROPY_SETUP_ check in __init__.py --- astropy/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/astropy/__init__.py b/astropy/__init__.py index bba8d48d6c73..d05f7a7b63b3 100644 --- a/astropy/__init__.py +++ b/astropy/__init__.py @@ -6,12 +6,18 @@ managing them. """ +# Prior to Astropy 3.2, astropy was imported during setup.py commands. If we are +# in setup mode, then astropy-helpers defines an _ASTROPY_SETUP_ variable, which +# we used to use to conditionally import C extensions for example. However, the +# behavior of importing the package during the setup process is not good +# practice and we therefore now explicitly prevent the package from being +# imported in that case to prevent any regressions. try: _ASTROPY_SETUP_ except NameError: pass else: - raise Exception("Can't import astropy at setup time") + raise Exception("The astropy package cannot be imported during setup") import sys import os