Skip to content

Commit

Permalink
Add a comment about the _ASTROPY_SETUP_ check in __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Feb 8, 2019
1 parent 3db2ff6 commit 712d29e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion astropy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 712d29e

Please sign in to comment.