1 # Wrapper to run Sphinx. We avoid using sphinx-build because we need to use
2 # the Python3 version and it's hard to ensure we find the appropriate one.
4 # We can't easily put this code inline in the Makefile because you can't write
5 # try/except on a single-line in Python.
9 # Newer way, required as of Sphinx 2.0.
10 from sphinx.cmd.build import build_main
11 sys.exit(build_main(sys.argv[1:]))
13 # Sphinx < 1.7.0 didn't have sphinx.cmd.build.
15 # Prior to Sphinx 1.7.0, sphinx.main always skipped the first argument
16 # passed. In 1.7.0 it stopped doing this, but this fallback handling
17 # should only be used for older versions so we no longer need to worry
19 from sphinx import main
20 sys.exit(main(sys.argv))