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

Skip to content

Commit ffdd946

Browse files
committed
Merge pull request #1660 from vterron/master
Explain that matplotlib must be built before the HTML documentation
2 parents abe4b3e + 3a38438 commit ffdd946

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

doc/README.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ for the initial run (which builds the example gallery) to be done,
3939
then run "python make.py html" again. The top file of the results will
4040
be ./build/html/index.html
4141

42+
Note that Sphinx uses the installed version of the package to build
43+
the documentation, so matplotlib must be installed *before* the docs
44+
can be generated. Even if that is the case, one of the files needed
45+
to do this, '../lib/matplotlib/mpl-data/matplotlibrc', is not version
46+
controlled, but created when matplotlib is built. This means that the
47+
documentation cannot be generated immediately after checking out the
48+
source code, even if matplotlib is installed on your system: you will
49+
have to run ``python setup.py build`` first.
50+
4251
To build a smaller version of the documentation (without
4352
high-resolution PNGs and PDF examples), type "python make.py --small
4453
html".

doc/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@
4747
# other places throughout the built documents.
4848
#
4949
# The short X.Y version.
50-
import matplotlib
50+
try:
51+
import matplotlib
52+
except ImportError:
53+
msg = "Error: matplotlib must be installed before building the documentation"
54+
sys.exit(msg)
55+
5156
version = matplotlib.__version__
5257
# The full version, including alpha/beta/rc tags.
5358
release = version

doc/make.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,15 @@ def copytree(src, dst, symlinks=False, ignore=None):
110110
def copy_if_out_of_date(original, derived):
111111
if (not os.path.exists(derived) or
112112
os.stat(derived).st_mtime < os.stat(original).st_mtime):
113-
shutil.copyfile(original, derived)
113+
try:
114+
shutil.copyfile(original, derived)
115+
except IOError:
116+
if os.path.basename(original) == 'matplotlibrc':
117+
msg = "'%s' not found. " % original + \
118+
"Did you run `python setup.py build`?"
119+
raise IOError(msg)
120+
else:
121+
raise
114122

115123
def check_build():
116124
build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex',

0 commit comments

Comments
 (0)