# Make sure tmpfiles' aging doesn't interfere with our workspace
# while we are working on it.
with MkosiState(args, config) as state, scopedenv({"TMPDIR" : str(state.workspace)}):
- # python caches the default temporary directory so when we modify TMPDIR we have to make sure it gets
- # recalculated (see https://docs.python.org/3/library/tempfile.html#tempfile.tempdir).
- tempfile.tempdir = None
-
install_package_manager_trees(state)
with mount_image(state):
import resource
import stat
import sys
+import tempfile
from collections.abc import Iterable, Iterator, Mapping
from pathlib import Path
from typing import Any, Callable, Optional, TypeVar
old = copy.copy(os.environ)
os.environ |= env
+ # python caches the default temporary directory so when we might modify TMPDIR we have to make sure it
+ # gets recalculated (see https://docs.python.org/3/library/tempfile.html#tempfile.tempdir).
+ tempfile.tempdir = None
+
try:
yield
finally:
os.environ = old
+ tempfile.tempdir = None