Bug 1390693 - Use separate variable for the base output directory; r?dustin draft
authorGregory Szorc <gps@mozilla.com>
Thu, 24 Aug 2017 10:31:41 -0700
changeset 652429 8b10c11e19d9ffe29ae030c2201cb6626ca449e7
parent 652428 47a570bd7cd1a1315f7d30051d87c2cc2d537548
child 652430 1f7646e1d27bb3301c6ad422bedd54866950bc70
push id76055
push usergszorc@mozilla.com
push dateThu, 24 Aug 2017 20:42:35 +0000
reviewersdustin
bugs1390693
milestone57.0a1
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
tools/docs/mach_commands.py
--- 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,