1
0
Fork 0
mirror of https://github.com/fastogt/pyfastogt synced 2025-03-09 23:38:55 +00:00

force symlink

This commit is contained in:
topilski 2017-06-05 22:06:42 +03:00
parent 607e77b2d0
commit 2a838e7a31
2 changed files with 15 additions and 4 deletions

View file

@ -1,7 +1,6 @@
#!/usr/bin/env python
import platform
import re
import subprocess
from abc import ABCMeta, abstractmethod

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python
import errno
import os
import re
import shutil
@ -136,3 +137,14 @@ def git_clone(url, current_dir):
common_git_clone_init_line = ['git', 'submodule', 'update', '--init', '--recursive']
subprocess.call(common_git_clone_init_line)
return os.path.join(current_dir, cloned_dir)
def symlink_force(target, link_name):
try:
os.symlink(target, link_name)
except OSError as e:
if e.errno == errno.EEXIST:
os.remove(link_name)
os.symlink(target, link_name)
else:
raise e