Handle broken symlinks in release scope copy
- Skip symlinks with non-existent targets (e.g., external/ArcGIS) - Prevents FileNotFoundError during package build Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 file changed
+6
-1
@@ -163,9 +163,14 @@ def copy_src_dir_to_dest_dir(srcdir, dstdir, perm=None, with_subdirs=True, relea
|
||||
if release_scope and rel_root == '.':
|
||||
if file not in release_items and not any(file == item.split('/')[0] for item in release_items if '/' in item):
|
||||
continue
|
||||
src_path = os.path.join(root, file)
|
||||
# Skip broken symlinks
|
||||
if os.path.islink(src_path) and not os.path.exists(src_path):
|
||||
debug(f"Skipping broken symlink: {src_path}")
|
||||
continue
|
||||
if os.path.isfile(tmpdir) and os.path.exists(tmpdir):
|
||||
os.remove(tmpdir)
|
||||
shutil.copy(os.path.join(root, file), tmpdir)
|
||||
shutil.copy(src_path, tmpdir, follow_symlinks=True)
|
||||
if perm:
|
||||
f = os.path.join(tmpdir, file)
|
||||
add_perm = 0
|
||||
|
||||
Reference in new issue
Block a user