Backed out changeset 7703531b8600 (bug 1593084) for Linting opt. CLOSED TREE

This commit is contained in:
Narcis Beleuzu 2019-11-06 00:13:52 +02:00
Родитель 892767cef9
Коммит e4b2faa491
3 изменённых файлов: 13 добавлений и 99 удалений

Просмотреть файл

@ -2,49 +2,18 @@
Mozilla Source Tree Documentation Mozilla Source Tree Documentation
================================= =================================
Source code doc .. toctree::
:maxdepth: 1
{indexes}
Python Packages
=============== ===============
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
{source_doc} {python_packages}
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}
Managing Documentation Managing Documentation
====================== ======================
@ -80,9 +49,6 @@ for it:
documentation for, you can use ``SPHINX_PYTHON_PACKAGE_DIRS`` to documentation for, you can use ``SPHINX_PYTHON_PACKAGE_DIRS`` to
declare directories containing Python packages. e.g. declare directories containing Python packages. e.g.
``SPHINX_PYTHON_PACKAGE_DIRS += ['mozpackage']``. ``SPHINX_PYTHON_PACKAGE_DIRS += ['mozpackage']``.
5. In ``tools/docs/tree.json``, defines in which category the doc
should go.
Indices and tables Indices and tables
================== ==================

Просмотреть файл

@ -4,7 +4,6 @@
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import json
import os import os
from mozbuild.base import MozbuildObject from mozbuild.base import MozbuildObject
@ -117,9 +116,6 @@ class _SphinxManager(object):
def _synchronize_docs(self): def _synchronize_docs(self):
m = InstallManifest() 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') m.add_link(self.conf_py_path, 'conf.py')
for dest, source in sorted(self.trees.items()): for dest, source in sorted(self.trees.items()):
@ -149,29 +145,14 @@ class _SphinxManager(object):
return False return False
return True 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)} 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 = {} packages = [os.path.basename(p) for p in self.python_package_dirs]
# generate the datastructure to deal with the tree packages = ['python/%s' % p for p in packages]
for t in tree_config: packages = '\n '.join(sorted(packages))
CATEGORIES[t] = format_paths(tree_config[t]) data = data.format(indexes=indexes, python_packages=packages)
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)
with open(os.path.join(self.staging_dir, 'index.rst'), 'wb') as fh: with open(os.path.join(self.staging_dir, 'index.rst'), 'wb') as fh:
fh.write(data) fh.write(data)

Просмотреть файл

@ -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"
]
}