MCPcopy
hub / github.com/sphinx-doc/sphinx / setup

Method setup

sphinx/environment/__init__.py:258–295  ·  view source on GitHub ↗

Set up BuildEnvironment object.

(self, app: Sphinx)

Source from the content-addressed store, hash-verified

256 self.__dict__.update(state)
257
258 def setup(self, app: Sphinx) -> None:
259 """Set up BuildEnvironment object."""
260 if self.version and self.version != _get_env_version(app.extensions):
261 raise BuildEnvironmentError(__('build environment version not current'))
262 if self.srcdir and self.srcdir != app.srcdir:
263 raise BuildEnvironmentError(__('source directory has changed'))
264
265 if self.project:
266 app.project.restore(self.project)
267
268 self._app = app
269 self.doctreedir = app.doctreedir
270 self.events = app.events
271 self.srcdir = app.srcdir
272 self.project = app.project
273 self.version = _get_env_version(app.extensions)
274
275 # initialise domains
276 if self.domains is None:
277 # if we are unpickling an environment, we need to recreate the domains
278 self.domains = _DomainsContainer._from_environment(
279 self, registry=app.registry
280 )
281 # setup domains (must do after all initialization)
282 self.domains._setup()
283
284 # Initialise config.
285 # The old config is self.config, restored from the pickled environment.
286 # The new config is app.config, always recreated from ``conf.py``
287 self.config_status, self.config_status_extra = self._config_status(
288 old_config=self.config,
289 new_config=app.config,
290 verbosity=app.config.verbosity,
291 )
292 self.config = app.config
293
294 # initialize settings
295 self._update_settings(app.config)
296
297 @property
298 def app(self) -> Sphinx:

Callers 2

__init__Method · 0.95
mainFunction · 0.45

Calls 7

_config_statusMethod · 0.95
_update_settingsMethod · 0.95
_get_env_versionFunction · 0.85
_from_environmentMethod · 0.80
_setupMethod · 0.80
restoreMethod · 0.45

Tested by

no test coverage detected