From 317d60307d7310f0987951164c2c70098b8b5749 Mon Sep 17 00:00:00 2001
From: David Lord <davidism@gmail.com>
Date: Mon, 11 Apr 2016 16:10:51 -0700
Subject: [PATCH] fix some warnings while building docs

---
 docs/conf.py        | 29 +++++++++++++++--------------
 docs/extensions.rst |  2 ++
 docs/upgrading.rst  |  8 ++++----
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 285c8981..880e9122 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -10,7 +10,7 @@
 #
 # All configuration values have a default; values that are commented out
 # serve to show the default.
-
+from __future__ import print_function
 import sys, os
 
 # If extensions (or modules to document with autodoc) are in another directory,
@@ -26,8 +26,11 @@ sys.path.append(os.path.abspath('.'))
 
 # Add any Sphinx extension module names here, as strings. They can be extensions
 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
-              'flaskdocext']
+extensions = [
+    'sphinx.ext.autodoc',
+    'sphinx.ext.intersphinx',
+    'flaskdocext'
+]
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
@@ -52,10 +55,8 @@ import pkg_resources
 try:
     release = pkg_resources.get_distribution('Flask').version
 except pkg_resources.DistributionNotFound:
-    print 'To build the documentation, The distribution information of Flask'
-    print 'Has to be available.  Either install the package into your'
-    print 'development environment or run "setup.py develop" to setup the'
-    print 'metadata.  A virtualenv is recommended!'
+    print('Flask must be installed to build the documentation.')
+    print('Install from source using `pip install -e .` in a virtualenv.')
     sys.exit(1)
 del pkg_resources
 
@@ -258,13 +259,13 @@ pygments_style = 'flask_theme_support.FlaskyStyle'
 # fall back if theme is not there
 try:
     __import__('flask_theme_support')
-except ImportError, e:
-    print '-' * 74
-    print 'Warning: Flask themes unavailable.  Building with default theme'
-    print 'If you want the Flask themes, run this command and build again:'
-    print
-    print '  git submodule update --init'
-    print '-' * 74
+except ImportError as e:
+    print('-' * 74)
+    print('Warning: Flask themes unavailable.  Building with default theme')
+    print('If you want the Flask themes, run this command and build again:')
+    print()
+    print('  git submodule update --init')
+    print('-' * 74)
 
     pygments_style = 'tango'
     html_theme = 'default'
diff --git a/docs/extensions.rst b/docs/extensions.rst
index c9af3035..d1d24807 100644
--- a/docs/extensions.rst
+++ b/docs/extensions.rst
@@ -1,3 +1,5 @@
+.. _extensions:
+
 Flask Extensions
 ================
 
diff --git a/docs/upgrading.rst b/docs/upgrading.rst
index e89e8765..eede3f6e 100644
--- a/docs/upgrading.rst
+++ b/docs/upgrading.rst
@@ -25,7 +25,7 @@ Version 1.0
 -----------
 
 Debugging
-+++++++++
+`````````
 
 Flask 1.0 removed the ``debug_log_format`` attribute from Flask
 applications.  Instead the new ``LOGGER_HANDLER_POLICY`` configuration can
@@ -33,7 +33,7 @@ be used to disable the default log handlers and custom log handlers can be
 set up.
 
 Error handling
-++++++++++++++
+``````````````
 
 The behavior of error handlers was changed.
 The precedence of handlers used to be based on the decoration/call order of
@@ -53,14 +53,14 @@ Trying to register a handler on an instance now raises :exc:`ValueError`.
     handlers only using exception classes and HTTP error codes.
 
 Templating
-++++++++++
+``````````
 
 The :func:`~flask.templating.render_template_string` function has changed to
 autoescape template variables by default. This better matches the behavior
 of :func:`~flask.templating.render_template`.
     
 Extension imports
-+++++++++++++++++
+`````````````````
 
 Extension imports of the form ``flask.ext.foo`` are deprecated, you should use
 ``flask_foo``.