Factor out function to decode 2 hex digits
[xapian.git] / xapian-bindings / python3 / sphinx-build
blob8bf61c4137fa13273c46453abaf9560fa3eb1029
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.
7 import sys
8 try:
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:]))
12 except ImportError:
13     # Sphinx < 1.7.0 didn't have sphinx.cmd.build.
14     #
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
18     # about this.
19     from sphinx import main
20     sys.exit(main(sys.argv))