Commit a82a2992 authored by eric pellegrini's avatar eric pellegrini

fix retrocompatibility bug

parent 92cb4738
...@@ -171,6 +171,12 @@ SCRIPTS = glob.glob(os.path.join(SCRIPTS_PATH,'mdanse*')) ...@@ -171,6 +171,12 @@ SCRIPTS = glob.glob(os.path.join(SCRIPTS_PATH,'mdanse*'))
if sphinx: if sphinx:
import sphinx.setup_command import sphinx.setup_command
try:
from sphinx.ext.apidoc import main as sphinx_apidoc_main
except ImportError:
from sphinx.apidoc import main as sphinx_apidoc_main
class mdanse_build_doc(sphinx.setup_command.BuildDoc): class mdanse_build_doc(sphinx.setup_command.BuildDoc):
def run(self): def run(self):
...@@ -190,9 +196,7 @@ if sphinx: ...@@ -190,9 +196,7 @@ if sphinx:
os.mkdir(sphinxDir) os.mkdir(sphinxDir)
metadata = self.distribution.metadata metadata = self.distribution.metadata
args = ["-F",
args = ["sphinx-apidoc",
"-F",
"--separate", "--separate",
"-H%s" % metadata.name, "-H%s" % metadata.name,
"-A%s" % metadata.author, "-A%s" % metadata.author,
...@@ -201,7 +205,12 @@ if sphinx: ...@@ -201,7 +205,12 @@ if sphinx:
os.path.join(buildDir,'MDANSE'), os.path.join(buildDir,'MDANSE'),
os.path.join(buildDir,'MDANSE','Externals')] os.path.join(buildDir,'MDANSE','Externals')]
p = subprocess.call(args)
# /!\ apidoc.main is deprecated. The API has been broken in sphinx 1.7.0, see https://github.com/sphinx-doc/sphinx/issues/4615
if int(sphinx.__version__.split(".")[1]) <= 6:
args.insert(0,"")
sphinx_apidoc_main(args)
currentDirectory = os.getcwd() currentDirectory = os.getcwd()
...@@ -218,8 +227,13 @@ if sphinx: ...@@ -218,8 +227,13 @@ if sphinx:
# The directory where the documentation will be built # The directory where the documentation will be built
self.build_dir = os.path.join(buildDir,'MDANSE','Doc',self.doctype) self.build_dir = os.path.join(buildDir,'MDANSE','Doc',self.doctype)
self.builder_target_dir = os.path.join(self.build_dir, self.builder) if isinstance(self.builder,basestring):
builders = [self.builder]
else:
builders = self.builder
for builder in builders:
self.builder_target_dir = os.path.join(self.build_dir, builder)
sphinx.setup_command.BuildDoc.run(self) sphinx.setup_command.BuildDoc.run(self)
sys.path.pop(0) sys.path.pop(0)
...@@ -232,20 +246,6 @@ if sphinx: ...@@ -232,20 +246,6 @@ if sphinx:
doctype = 'api' doctype = 'api'
#################################
# Debian packaging
#################################
#class mdanse_build(build):
# def has_sphinx(self):
# if sphinx is None:
# return False
# setup_dir = os.path.dirname(os.path.abspath(__file__))
# return os.path.isdir(os.path.join(setup_dir, 'Doc'))
# sub_commands = build.sub_commands# + [('build_api', has_sphinx),('build_help',has_sphinx)]
################################# #################################
# Extensions section # Extensions section
################################# #################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment