-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToolset.py
More file actions
37 lines (29 loc) · 770 Bytes
/
Toolset.py
File metadata and controls
37 lines (29 loc) · 770 Bytes
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
from SCons.Environment import Environment
from abc import ABC, abstractmethod
class ToolsetAction(ABC):
@abstractmethod
def add_to_environment(self, env: Environment):
pass
class Toolset:
def __init__(self, name: str):
self.name = name
@abstractmethod
def __iter__(self):
pass
@abstractmethod
def __next__(self) -> ToolsetAction|StopIteration:
pass
class ToolsetEnvironment:
def __init__(self, env: Environment, toolset: Toolset):
self._env = env
self._toolset = toolset
def add_to_environment(self):
for action in self._toolset: # type: ignore
if action is not None:
action.add_to_environment(self._env)
@property
def toolset(self) -> Toolset:
return self._toolset
@property
def env(self) -> Environment:
return self._env