From e4b2faa4910aa7fd03aa7c126a9252f82854edf4 Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Wed, 6 Nov 2019 00:13:52 +0200 Subject: [PATCH] Backed out changeset 7703531b8600 (bug 1593084) for Linting opt. CLOSED TREE --- tools/docs/index.rst | 48 +++++------------------------- tools/docs/moztreedocs/__init__.py | 31 ++++--------------- tools/docs/tree.json | 33 -------------------- 3 files changed, 13 insertions(+), 99 deletions(-) delete mode 100644 tools/docs/tree.json diff --git a/tools/docs/index.rst b/tools/docs/index.rst index 3b4bf984bd1d..ae2a9d593050 100644 --- a/tools/docs/index.rst +++ b/tools/docs/index.rst @@ -2,49 +2,18 @@ Mozilla Source Tree Documentation ================================= -Source code doc +.. toctree:: + :maxdepth: 1 + + {indexes} + +Python Packages =============== .. toctree:: :maxdepth: 2 - {source_doc} - - -Build -===== - -.. toctree:: - :maxdepth: 1 - - {build_doc} - - -Testing -======= - -.. toctree:: - :maxdepth: 1 - - {testing_doc} - -Python -====== - -.. toctree:: - :maxdepth: 1 - - {python_doc} - - -Code quality -============ - -.. toctree:: - :maxdepth: 1 - - {code_quality_doc} - + {python_packages} Managing Documentation ====================== @@ -80,9 +49,6 @@ for it: documentation for, you can use ``SPHINX_PYTHON_PACKAGE_DIRS`` to declare directories containing Python packages. e.g. ``SPHINX_PYTHON_PACKAGE_DIRS += ['mozpackage']``. -5. In ``tools/docs/tree.json``, defines in which category the doc - should go. - Indices and tables ================== diff --git a/tools/docs/moztreedocs/__init__.py b/tools/docs/moztreedocs/__init__.py index 19f4c1ff3008..f3e3ef1a089c 100644 --- a/tools/docs/moztreedocs/__init__.py +++ b/tools/docs/moztreedocs/__init__.py @@ -4,7 +4,6 @@ from __future__ import absolute_import, unicode_literals -import json import os from mozbuild.base import MozbuildObject @@ -117,9 +116,6 @@ class _SphinxManager(object): def _synchronize_docs(self): m = InstallManifest() - with open(os.path.join(MAIN_DOC_PATH, "tree.json")) as json_data: - tree_config = json.load(json_data) - m.add_link(self.conf_py_path, 'conf.py') for dest, source in sorted(self.trees.items()): @@ -149,29 +145,14 @@ class _SphinxManager(object): return False return True - def format_paths(paths): - source_doc = ['%s/index' % p for p in paths] - return '\n '.join(source_doc) - toplevel_trees = {k: v for k, v in self.trees.items() if is_toplevel(k)} + indexes = ['%s/index' % p for p in sorted(toplevel_trees.keys())] + indexes = '\n '.join(indexes) - CATEGORIES = {} - # generate the datastructure to deal with the tree - for t in tree_config: - CATEGORIES[t] = format_paths(tree_config[t]) - - indexes = set(['%s/index' % p for p in toplevel_trees.keys()]) - # Format categories like indexes - cats = '\n'.join(CATEGORIES.values()).split("\n") - # Remove heading spaces - cats = [x.strip() for x in cats] - indexes = tuple(set(indexes) - set(cats)) - if indexes: - # In case a new doc isn't categorized - print(indexes) - raise Exception("Uncategorized documentation. Please add it in tools/docs/tree.json") - print(data) - data = data.format(**CATEGORIES) + packages = [os.path.basename(p) for p in self.python_package_dirs] + packages = ['python/%s' % p for p in packages] + packages = '\n '.join(sorted(packages)) + data = data.format(indexes=indexes, python_packages=packages) with open(os.path.join(self.staging_dir, 'index.rst'), 'wb') as fh: fh.write(data) diff --git a/tools/docs/tree.json b/tools/docs/tree.json deleted file mode 100644 index c68e567de365..000000000000 --- a/tools/docs/tree.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "source_doc": [ - "browser", - "dom/dom", - "gfx/gfx", - "toolkit", - "dom/bindings/webidl", - "modules/libpref/libpref", - "remote", - "services/common/services" - ], - "build_doc": [ - "python/mach", - "tools/try", - "build/buildsystem", - "taskcluster/taskcluster" - ], - "testing_doc": [ - "testing/marionette", - "testing/geckodriver" - ], - "code_quality_doc": [ - "tools/lint" - ], - "l10n_doc": [ - "intl", - "tools/compare-locales" - ], - "python_doc": [ - "mozbase", - "python/python" - ] -}