File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,20 @@ def add_mim_extension():
134134
135135 if mode == 'symlink' :
136136 src_relpath = osp .relpath (src_path , osp .dirname (tar_path ))
137- os .symlink (src_relpath , tar_path )
138- elif mode == 'copy' :
137+ try :
138+ os .symlink (src_relpath , tar_path )
139+ except OSError :
140+ # Creating a symbolic link on windows may raise an
141+ # `OSError: [WinError 1314]` due to privilege. If
142+ # the error happens, the src file will be copied
143+ mode = 'copy'
144+ warnings .warn (
145+ f'Failed to create a symbolic link for { src_relpath } , '
146+ f'and it will be copied to { tar_path } ' )
147+ else :
148+ continue
149+
150+ if mode == 'copy' :
139151 if osp .isfile (src_path ):
140152 shutil .copyfile (src_path , tar_path )
141153 elif osp .isdir (src_path ):
You can’t perform that action at this time.
0 commit comments