Bug 1390693 - Use separate variable for the base output directory; r?dustin
An upcoming commit will want to put something outside the
format-specific output directory.
MozReview-Commit-ID: 2kYDREddpN
--- a/tools/docs/mach_commands.py
+++ b/tools/docs/mach_commands.py
@@ -42,31 +42,32 @@ class Documentation(MachCommandBase):
import sphinx
import webbrowser
if not outdir:
outdir = os.path.join(self.topobjdir, 'docs')
if not what:
what = [os.path.join(self.topsrcdir, 'tools')]
- outdir = os.path.join(outdir, format)
+
+ format_outdir = os.path.join(outdir, format)
generated = []
failed = []
for path in what:
path = os.path.normpath(os.path.abspath(path))
docdir = self._find_doc_dir(path)
if not docdir:
failed.append((path, 'could not find docs at this location'))
continue
# find project name to use as a namespace within `outdir`
project = self._find_project_name(docdir)
- savedir = os.path.join(outdir, project)
+ savedir = os.path.join(format_outdir, project)
args = [
'sphinx',
'-b', format,
docdir,
savedir,
]
result = sphinx.build_main(args)
@@ -87,17 +88,18 @@ class Documentation(MachCommandBase):
return die('failed to generate documentation:\n%s' % '\n'.join(failed))
if http is not None:
host, port = http.split(':', 1)
addr = (host, int(port))
if len(addr) != 2:
return die('invalid address: %s' % http)
- httpd = mozhttpd.MozHttpd(host=addr[0], port=addr[1], docroot=outdir)
+ httpd = mozhttpd.MozHttpd(host=addr[0], port=addr[1],
+ docroot=format_outdir)
print('listening on %s:%d' % addr)
httpd.start(block=True)
def _find_project_name(self, path):
import imp
path = os.path.join(path, 'conf.py')
with open(path, 'r') as fh:
conf = imp.load_module('doc_conf', fh, path,