File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ def symlink_force(target, link_name):
105105
106106 # prefer relative symlink rather than absolute
107107 # check first if target is absolute or relative
108+ target_orig = target
108109 if os .path .isabs (target ):
109110 target = os .path .relpath (target , os .path .dirname (link_name ))
110111
@@ -117,6 +118,20 @@ def symlink_force(target, link_name):
117118 else :
118119 raise exc
119120
121+ # If a relative link is invalid, retry with absolute path if available
122+ if not os .path .exists (link_name ):
123+ if target != target_orig :
124+ os .remove (link_name )
125+ os .symlink (target_orig , link_name )
126+
127+ if not os .path .exists (link_name ):
128+ error (
129+ "ERROR: Failed to create valid link from {0} to {1}" .format (
130+ link_name , target_orig
131+ )
132+ )
133+ raise RuntimeError ()
134+
120135
121136def copydir (src_dir , target_dir ):
122137 import os
Original file line number Diff line number Diff line change 1+ *
2+ ! .gitignore
Original file line number Diff line number Diff line change 1+ *
2+ ! .gitignore
You can’t perform that action at this time.
0 commit comments