More cases of neading to clean during execution
This commit is contained in:
parent
e39df4d663
commit
0cfedb398a
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