From 980f3afa0bef2b0c4a07ac2a5ab98bc9ac24aa69 Mon Sep 17 00:00:00 2001 From: Gavin John Date: Tue, 26 Aug 2025 16:02:31 -0400 Subject: [PATCH] I bet this is more correct too --- ci/nur/combine.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ci/nur/combine.py b/ci/nur/combine.py index 1ac02bab9..2841466a8 100644 --- a/ci/nur/combine.py +++ b/ci/nur/combine.py @@ -50,9 +50,11 @@ def commit_repo(repo: Repo, message: str, path: Path) -> Repo: assert tmp is not None try: + # dirs_exist_ok=True because our directory definitely already exists shutil.copytree(repo_source(repo.name), tmp.name, symlinks=True, dirs_exist_ok=True) - shutil.rmtree(repo_path, ignore_errors=True) - shutil.move(tmp.name, repo_path) + if os.path.exists(repo_path): + shutil.rmtree(repo_path) + shutil.copytree(tmp, repo_path, symlinks=True) tmp = None finally: if tmp is not None: @@ -159,9 +161,9 @@ def setup_combined() -> None: write_json_file(dict(repos={}), manifest_path) manifest_lib = "lib" - shutil.copytree( - str(ROOT.joinpath("lib")), manifest_lib, symlinks=True, dirs_exist_ok=True - ) + if os.path.exists(manifest_lib): + shutil.rmtree(manifest_lib) + shutil.copytree(str(ROOT.joinpath("lib")), manifest_lib, symlinks=True) default_nix = "default.nix" shutil.copy(ROOT.joinpath("default.nix"), default_nix)