Fixes the environment used for the doc-build script.

Fixes #2004