More cases of neading to clean during execution
This commit is contained in:
parent
20f3f01b6a
commit
0514e4ebb2
1 changed files with 10 additions and 2 deletions
|
@ -32,11 +32,14 @@ class Vfs(object):
|
|||
if dest.is_symlink() and dest.readlink() == src:
|
||||
continue
|
||||
else:
|
||||
_log.warn(f"Replacing {dest}")
|
||||
dest.unlink()
|
||||
elif dest.is_dir():
|
||||
_log.warn(f"Replacing {dest}")
|
||||
rmtree(dest)
|
||||
|
||||
assert not dest.exists()
|
||||
assert not dest.exists(), f"{dest} should not exist"
|
||||
dest.symlink_to(src)
|
||||
assert dest.exists()
|
||||
|
||||
elif e[0] == "copy":
|
||||
raise NotImplementedError()
|
||||
|
@ -47,6 +50,11 @@ class Vfs(object):
|
|||
|
||||
elif e[0] == "mkdir":
|
||||
_, dest = e
|
||||
if dest.is_dir():
|
||||
continue
|
||||
elif dest.exists() or dest.is_symlink():
|
||||
dest.unlink()
|
||||
|
||||
dest.mkdir(exist_ok=True)
|
||||
|
||||
elif e[0] == "unlink":
|
||||
|
|
Loading…
Reference in a new issue