Bug 1727819: Remove redundant virtualenv activation for docs r=ahal

Sphinx already runs within the `./mach doc` command, which has the
`docs` virtualenv activated. Activating another virtualenv within a
Sphinx python file is redundant.

Differential Revision: https://phabricator.services.mozilla.com/D135305
This commit is contained in:
Mitchell Hentges 2022-01-19 19:57:20 +00:00
parent cd4c0ec445
commit e247709b23

View File

@ -5,7 +5,6 @@
from __future__ import absolute_import, print_function from __future__ import absolute_import, print_function
import importlib import importlib
import os
from docutils.parsers.rst import Directive from docutils.parsers.rst import Directive
from sphinx.util.docstrings import prepare_docstring from sphinx.util.docstrings import prepare_docstring
@ -197,8 +196,6 @@ class MozbuildSymbols(Directive):
def setup(app): def setup(app):
from mach.site import CommandSiteManager
from mozboot.util import get_state_dir
from moztreedocs import manager from moztreedocs import manager
app.add_directive("mozbuildsymbols", MozbuildSymbols) app.add_directive("mozbuildsymbols", MozbuildSymbols)
@ -211,14 +208,3 @@ def setup(app):
# documentation. # documentation.
manager.generate_docs(app) manager.generate_docs(app)
app.srcdir = manager.staging_dir app.srcdir = manager.staging_dir
# We need to adjust sys.path in order for Python API docs to get generated
# properly. We leverage the in-tree virtualenv for this.
topsrcdir = manager.topsrcdir
site = CommandSiteManager.from_environment(
topsrcdir,
lambda: get_state_dir(specific_to_topsrcdir=True, topsrcdir=topsrcdir),
"common",
os.path.join(app.outdir, "_venv"),
)
site.activate()