Skip to content

Commit bccbc2c

Browse files
authored
Merge pull request matplotlib#29948 from dstansby/boilerplate-path-check
2 parents 3274d6a + ad6431e commit bccbc2c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tools/boilerplate.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -459,5 +459,13 @@ def update_sig_from_node(node, sig):
459459
if len(sys.argv) > 1:
460460
pyplot_path = Path(sys.argv[1])
461461
else:
462-
pyplot_path = Path(__file__).parent / "../lib/matplotlib/pyplot.py"
462+
mpl_path = (Path(__file__).parent / ".." /"lib"/"matplotlib").resolve()
463+
pyplot_path = mpl_path / "pyplot.py"
464+
for cls in [Axes, Figure]:
465+
if mpl_path not in Path(inspect.getfile(cls)).parents:
466+
raise RuntimeError(
467+
f"{cls.__name__} import path is not {mpl_path}.\n"
468+
"Please make sure your Matplotlib installation "
469+
"is from the same source checkout as boilerplate.py"
470+
)
463471
build_pyplot(pyplot_path)

0 commit comments

Comments
 (0)