re-create tmpdir after successfull rename
This patch adds a workaround for python versions < 3.8. There, the dir created by TemporaryDirectory must still exist when leaving the context manager. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
f2560588bc
commit
3289ec2a7e
@ -200,6 +200,9 @@ class RepoImpl(Repo):
|
|||||||
logging.debug('Created repo ref for %s', self.qualified_name)
|
logging.debug('Created repo ref for %s', self.qualified_name)
|
||||||
try:
|
try:
|
||||||
os.rename(tmpdir, sdir)
|
os.rename(tmpdir, sdir)
|
||||||
|
if sys.version_info < (3, 8):
|
||||||
|
# recreate dir so cleanup handler can delete it
|
||||||
|
os.makedirs(tmpdir, exist_ok=True)
|
||||||
except OSError:
|
except OSError:
|
||||||
logging.debug('repo %s already cloned by other instance',
|
logging.debug('repo %s already cloned by other instance',
|
||||||
self.qualified_name)
|
self.qualified_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user