@ -15,6 +15,7 @@
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
__docformat__ = ' restructuredtext '
__docformat__ = ' restructuredtext '
@ -24,9 +25,9 @@ import traceback
try :
try :
from sphinx . application import Sphinx
from sphinx . application import Sphinx
except ImportError :
except ImportError :
print " ################################# "
print ( " ################################# " )
print " Dependency missing: Python Sphinx "
print ( " Dependency missing: Python Sphinx " )
print " ################################# "
print ( " ################################# " )
sys . exit ( 1 )
sys . exit ( 1 )
import os
import os
@ -40,7 +41,7 @@ class SphinxBuilder(object):
"""
"""
Run the DocCommand .
Run the DocCommand .
"""
"""
print " Creating html documentation ... "
print ( " Creating html documentation ... " )
try :
try :
buildername = ' html '
buildername = ' html '
@ -69,10 +70,10 @@ class SphinxBuilder(object):
app . builder . build_all ( )
app . builder . build_all ( )
except ImportError , ie :
except ImportError :
traceback . print_exc ( )
traceback . print_exc ( )
except Exception , ex :
except Exception as ex :
print >> sys . stderr , " FAIL! exiting ... ( %s ) " % ex
print ( " FAIL! exiting ... ( %s ) " % ex , file = sys . stderr )
def build_docs ( self ) :
def build_docs ( self ) :
self . app . builder . build_all ( )
self . app . builder . build_all ( )
@ -83,9 +84,9 @@ def build_rst_docs():
if __name__ == ' __main__ ' :
if __name__ == ' __main__ ' :
if ' -h ' in sys . argv or ' --help ' in sys . argv :
if ' -h ' in sys . argv or ' --help ' in sys . argv :
print " This script builds the html documentation from rst/asciidoc sources. \n "
print ( " This script builds the html documentation from rst/asciidoc sources. \n " )
print " Run ' make docs ' to build everything. "
print ( " Run ' make docs ' to build everything. " )
print " Run ' make viewdocs ' to build and then preview in a web browser. "
print ( " Run ' make viewdocs ' to build and then preview in a web browser. " )
sys . exit ( 0 )
sys . exit ( 0 )
build_rst_docs ( )
build_rst_docs ( )
@ -93,4 +94,4 @@ if __name__ == '__main__':
if " view " in sys . argv :
if " view " in sys . argv :
import webbrowser
import webbrowser
if not webbrowser . open ( ' htmlout/index.html ' ) :
if not webbrowser . open ( ' htmlout/index.html ' ) :
print >> sys . stderr , " Could not open on your webbrowser. "
print ( " Could not open on your webbrowser. " , file = sys . stderr )