From 4ad82b93b5f86a26120a7f76d6240400a2a79490 Mon Sep 17 00:00:00 2001 From: Ragnar Groot Koerkamp Date: Fri, 8 Mar 2024 18:37:18 +0100 Subject: [PATCH] Use absolute instead of resolve for symlink name; backup symlinks as symlinks --- bin/generate.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bin/generate.py b/bin/generate.py index 0460ef023..56db11f7e 100644 --- a/bin/generate.py +++ b/bin/generate.py @@ -1566,14 +1566,10 @@ def generate_copies_and_includes(d): def remove(self, src): if self.trashdir is None: self.trashdir = self.problem.tmpdir / secrets.token_hex(4) - assert src.is_relative_to(self.problem.path / 'data') - dst = self.trashdir / src.relative_to((self.problem.path / 'data')) + dst = self.trashdir / src.absolute().relative_to((self.problem.path / 'data').absolute()) dst.parent.mkdir(parents=True, exist_ok=True) - def copy(src, dst): - shutil.copy2(src, dst, follow_symlinks=False) - - shutil.move(src, dst, copy) + shutil.move(src, dst) def _remove_unknown(self, path, bar, silent=False): local = path.relative_to(self.problem.path / 'data')