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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
from typing import List, Type
import pluggy
from tox import provision
from tox.config import core as core_config
from tox.config.cli.parser import ToxParser
from tox.config.sets import ConfigSet
from tox.session.cmd import list_env, show_config, version_flag
from tox.session.cmd.run import parallel, sequential
from tox.tox_env import builder
from tox.tox_env.api import ToxEnv
from tox.tox_env.python.virtual_env import runner
from tox.tox_env.python.virtual_env.package import dev
from tox.tox_env.python.virtual_env.package.artifact import sdist, wheel
from tox.tox_env.register import REGISTER, ToxEnvRegister
from . import spec
from .util import NAME
class Plugin:
def __init__(self) -> None:
self.manager = pluggy.PluginManager(NAME) # type:pluggy.PluginManager
self.manager.add_hookspecs(spec)
internal_plugins = (
provision,
core_config,
runner,
sdist,
wheel,
dev,
parallel,
sequential,
list_env,
version_flag,
show_config,
)
for plugin in internal_plugins:
self.manager.register(plugin)
self.manager.load_setuptools_entrypoints(NAME)
self.manager.register(builder)
REGISTER.populate(self)
self.manager.check_pending()
def tox_add_option(self, parser: ToxParser) -> None:
self.manager.hook.tox_add_option(parser=parser)
def tox_add_core_config(self, core: ConfigSet) -> None:
self.manager.hook.tox_add_core_config(core=core)
def tox_register_tox_env(self, register: "ToxEnvRegister") -> List[Type[ToxEnv]]:
return self.manager.hook.tox_register_tox_env(register=register)
MANAGER = Plugin()
|