From 7bd37caa66babc59c7caec512b76303169c7d67a Mon Sep 17 00:00:00 2001 From: antarcticrainforest Date: Wed, 27 Sep 2023 09:56:02 +0200 Subject: [PATCH] Use pathlib to delete pot. existing data files before creating them. --- flit/install.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flit/install.py b/flit/install.py index a6e849d0..8fb5f9bf 100644 --- a/flit/install.py +++ b/flit/install.py @@ -201,8 +201,7 @@ def install_data_dir(self, target_data_dir): rel_path = os.path.relpath(src_path, self.ini_info.data_directory) dst_path = os.path.join(target_data_dir, rel_path) os.makedirs(os.path.dirname(dst_path), exist_ok=True) - if os.path.exists(dst_path): - os.remove(dst_path) + pathlib.Path(dst_path, missing_ok=True) if self.symlink: os.symlink(os.path.realpath(src_path), dst_path) else: