MCPcopy
hub / github.com/lektor/lektor / _temporary_folder

Function _temporary_folder

lektor/publisher.py:80–97  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

78
79@contextmanager
80def _temporary_folder(env):
81 base = env.temp_path
82 try:
83 os.makedirs(base)
84 except OSError:
85 pass
86
87 folder = tempfile.mkdtemp(prefix=".deploytemp", dir=base)
88 scratch = os.path.join(folder, "scratch")
89 os.mkdir(scratch)
90 os.chmod(scratch, 0o755)
91 try:
92 yield scratch
93 finally:
94 try:
95 shutil.rmtree(folder)
96 except (IOError, OSError):
97 pass
98
99
100class PublishError(LektorException):

Callers 2

publishMethod · 0.85
publishMethod · 0.85

Calls 1

mkdirMethod · 0.80

Tested by

no test coverage detected