Skip to content

Commit acfc085

Browse files
committed
don't symlink to self
Signed-off-by: Zen <[email protected]>
1 parent 407d8ad commit acfc085

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ugrd/generator_helpers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from zenlib.util import pretty_print, colorize
66

7-
__version__ = "1.5.2"
7+
__version__ = "1.5.3"
88
__author__ = "desultory"
99

1010

@@ -180,6 +180,9 @@ def _symlink(self, source: Union[Path, str], target: Union[Path, str]) -> None:
180180
else:
181181
raise RuntimeError("Symlink already exists: %s -> %s" % (target, target.resolve()))
182182

183+
if target.relative_to(self._get_build_path("/")) == source:
184+
return self.logger.debug("Cannot symlink to self: %s -> %s" % (target, source))
185+
183186
self.logger.debug("Creating symlink: %s -> %s" % (target, source))
184187
target.symlink_to(source)
185188

0 commit comments

Comments
 (0)