Skip to content

Commit

Permalink
Instead of wrapping the entire AstropyBuildSphinx definition in a try…
Browse files Browse the repository at this point in the history
…/except block, add a HAVE_SPHINX global variable a la HAVE_CYTHON; put the AstropyBuildSphinx definition in an if statement instead.
  • Loading branch information
embray committed Nov 2, 2012
1 parent cad977f commit 7f85b89
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions astropy/setup_helpers.py
Expand Up @@ -35,6 +35,13 @@
HAVE_CYTHON = False


try:
import sphinx
HAVE_SPHINX = True
except ImportError:
HAVE_SPHINX = False


class AstropyBuild(DistutilsBuild):
"""
A custom 'build' command that allows for adding extra build
Expand Down Expand Up @@ -192,7 +199,7 @@ def run(self):
AstropyInstall.add_install_option(*option)


try:
if HAVE_SPHINX:
from sphinx.setup_command import BuildDoc

class AstropyBuildSphinx(BuildDoc):
Expand Down Expand Up @@ -325,9 +332,6 @@ def run(self):

AstropyBuildSphinx.__name__ = 'build_sphinx'

except ImportError:
AstropyBuildSphinx = None


def get_distutils_display_options():
""" Returns a set of all the distutils display options in their long and
Expand Down

0 comments on commit 7f85b89

Please sign in to comment.