summaryrefslogtreecommitdiff
path: root/sphinx/environment/managers/__init__.py
blob: 963ec54b81007507366dbda95e64331c03583cb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
"""
    sphinx.environment.managers
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Manager components for sphinx.environment.

    :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""


class EnvironmentManager(object):
    """Base class for sphinx.environment managers."""
    name = None

    def __init__(self, env):
        self.env = env

    def attach(self, env):
        self.env = env
        if self.name:
            setattr(env, self.name, self)

    def detach(self, env):
        self.env = None
        if self.name:
            delattr(env, self.name)

    def clear_doc(self, docname):
        raise NotImplementedError

    def merge_other(self, docnames, other):
        raise NotImplementedError

    def process_doc(self, docname, doctree):
        raise NotImplementedError