Skip to content
Snippets Groups Projects
Commit fcb8d6f4 authored by Xavier Robin's avatar Xavier Robin
Browse files

Revert "Attempt to restore compatibility with older versions of Sphinx"

This reverts commit ef7bfdb6.

Didn't work with Sphinx 1.6.7 which needs an extra option at the start.
This needs to be fixed cleanly, or we need to upgrade the Sphinx version
requirements
parent ef7bfdb6
No related branches found
No related tags found
No related merge requests found
......@@ -5,12 +5,7 @@ import shutil
from ost import settings
from optparse import OptionParser
import subprocess
try:
# Import for new versions of Sphinx (tested with 2.3.0)
from sphinx.cmd.build import main as sphinx_main
except ImportError:
# Import for older versions of Sphinx (should work with 1.6.7)
from sphinx import main as sphinx_main
import sphinx.cmd.build
if len(sys.argv)==2:
root_dir=sys.argv[1]
......@@ -96,14 +91,14 @@ for sub_dir in ('modules',):
_CollectRstDocs('doc/source', directory, filenames)
if opts.html:
sphinx_main(extra_opts + ['-b', 'html', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
sphinx.cmd.build.main(extra_opts + ['-b', 'html', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
if opts.doctest:
sphinx_main(extra_opts + ['-b', 'doctest', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
sphinx.cmd.build.main(extra_opts + ['-b', 'doctest', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
if opts.build_json:
sphinx_main(extra_opts + ['-b', 'json', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
sphinx.cmd.build.main(extra_opts + ['-b', 'json', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
if opts.linkcheck:
sphinx_main(extra_opts + ['-b', 'linkcheck', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
sphinx.cmd.build.main(extra_opts + ['-b', 'linkcheck', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
  • Owner

    Just a thought: can you do

    import sphinx
    old_sphinx = sphinx.version_info[0] < 2

    and then solve it with some if statements?

    That is assuming that the change happened with the major version change of sphinx...

  • Author Maintainer

    Yes we can definitely add lots of if statements, but the functions are accepting different number of arguments (expecting argv[:] or argv[1:]) so that was getting really ugly. There must be a better way out of it.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment