Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update doc build. #8536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ doc/examples
doc/modules
doc/pyplots/tex_demo.png
doc/users/installing.rst
doc/_static/depsy_badge.svg
doc/_static/matplotlibrc
lib/dateutil
examples/*/*.pdf
Expand Down
5 changes: 3 additions & 2 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
# pip install -r doc-requirements.txt
#
sphinx>=1.3,!=1.5.0
numpydoc
colorspacious
ipython
mock
colorspacious
numpydoc
pillow
scipy
sphinx-gallery
74 changes: 30 additions & 44 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,48 +38,40 @@

exclude_patterns = ['api/api_changes/*', 'users/whats_new/*']

# Use IPython's console highlighting by default
try:
from IPython.sphinxext import ipython_console_highlighting
except ImportError:
raise ImportError(
"IPython must be installed to build the Matplotlib docs")
else:
extensions.append('IPython.sphinxext.ipython_console_highlighting')
extensions.append('IPython.sphinxext.ipython_directive')

try:
import numpydoc
except ImportError:
raise ImportError("No module named numpydoc - you need to install "
"numpydoc to build the documentation.")

try:
import sphinx_gallery
except ImportError:
raise ImportError("No module named sphinx_gallery - you need to install "
"sphinx_gallery to build the documentation.")

try:
import colorspacious
except ImportError:
raise ImportError("No module named colorspacious - you need to install "
"colorspacious to build the documentation")

def _check_deps():
names = ["colorspacious",
"IPython.sphinxext.ipython_console_highlighting",
"matplotlib",
"numpydoc",
"PIL.Image",
"scipy",
"sphinx_gallery"]
if sys.version_info < (3, 3):
names.append("mock")
missing = []
for name in names:
try:
__import__(name)
except ImportError:
missing.append(name)
if missing:
raise ImportError(
"The following dependencies are missing to build the "
"documentation: {}".format(", ".join(missing)))

_check_deps()

import matplotlib
try:
from unittest.mock import MagicMock
except ImportError:
try:
from mock import MagicMock
except ImportError:
raise ImportError("No module named mock - you need to install "
"mock to build the documentation")
from mock import MagicMock
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should mock now be in the list of dependencies on L43?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unittest.mock is part of the stdlib in py3.3+; we check for mock for py2.


try:
from PIL import Image
except ImportError:
raise ImportError("No module named Image - you need to install "
"pillow to build the documentation")

# Use IPython's console highlighting by default
extensions.extend(['IPython.sphinxext.ipython_console_highlighting',
'IPython.sphinxext.ipython_directive'])

if six.PY2:
from distutils.spawn import find_executable
Expand All @@ -92,12 +84,6 @@
"No binary named dot - you need to install the Graph Visualization "
"software (usually packaged as 'graphviz') to build the documentation")

try:
import matplotlib
except ImportError:
msg = "Error: Matplotlib must be installed before building the documentation"
sys.exit(msg)


autosummary_generate = True

Expand Down Expand Up @@ -134,7 +120,7 @@
project = 'Matplotlib'
copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
'Michael Droettboom and the Matplotlib development '
'team; 2012 - 2016 The Matplotlib development team')
'team; 2012 - 2017 The Matplotlib development team')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe overkill but we could always use

"...2012 - %s The Matplotlib development team" % day.year

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow automatically generating copyright years feels wrong to me...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe fair enough, just a thought :)

Copy link
Contributor

@choldgraf choldgraf Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can imagine in 3 years someone would realize it's showing "2012 - NULL_VALUE" or something


# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
Expand Down
7 changes: 4 additions & 3 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,14 @@ def build_all():
if args.n is not None:
n_proc = int(args.n)

_valid_commands = "Valid targets are: {}".format(", ".join(sorted(funcd)))
if args.cmd:
for command in args.cmd:
func = funcd.get(command)
if func is None:
raise SystemExit(('Do not know how to handle %s; valid commands'
' are %s' % (command, funcd.keys())))
raise SystemExit("Do not know how to handle {}. {}"
.format(command, _valid_commands))
func()
else:
all()
raise SystemExit(_valid_commands)
os.chdir(current_dir)