Skip to content

Commit b236b0f

Browse files
author
Víctor Terrón
committed
Show custom error message if we don't have a matplotlibrc file
Even if the README.txt file explicitly mentions that matplotlib must have been built before the documentation can be generated, a better error message will be of help to those developers who happen not to read it.
1 parent e532e18 commit b236b0f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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)