5from types
import TracebackType
6from typing
import Dict, Generator, Optional, Set, Type, Union
15@contextlib.contextmanager
20 non_existent_marker = object()
21 saved_values: Dict[str, Union[object, str]] = {}
24 saved_values[name] = target[name]
26 saved_values[name] = non_existent_marker
27 target[name] = new_value
34 if original_value
is non_existent_marker:
38 target[name] = original_value
41@contextlib.contextmanager
57 self.
_entries: Set[InstallRequirement] = set()
66 exc_type: Optional[Type[BaseException]],
67 exc_val: Optional[BaseException],
68 exc_tb: Optional[TracebackType],
76 def add(self, req: InstallRequirement) ->
None:
77 """Add an InstallRequirement to build tracking."""
86 with open(entry_path)
as fp:
88 except FileNotFoundError:
91 message =
"{} is already being built: {}".format(
req.link, contents)
98 with open(entry_path,
"w", encoding=
"utf-8")
as fp:
104 def remove(self, req: InstallRequirement) ->
None:
105 """Remove an InstallRequirement from build tracking."""
120 @contextlib.contextmanager
121 def track(self, req: InstallRequirement) -> Generator[
None,
None,
None]:
str _entry_path(self, Link link)
None __init__(self, str root)
None __exit__(self, Optional[Type[BaseException]] exc_type, Optional[BaseException] exc_val, Optional[TracebackType] exc_tb)
None add(self, InstallRequirement req)
Generator[None, None, None] track(self, InstallRequirement req)
None remove(self, InstallRequirement req)
"BuildTracker" __enter__(self)
Generator[None, None, None] update_env_context_manager(**str changes)
Generator["BuildTracker", None, None] get_build_tracker()