Treat broken symlinks corretcly #1394
This commit is contained in:
parent
7a8dc0dd70
commit
823188957c
@ -371,12 +371,12 @@ class ActivityBundle(Bundle):
|
|||||||
def _symlink(self, src, dst):
|
def _symlink(self, src, dst):
|
||||||
if not os.path.isfile(src):
|
if not os.path.isfile(src):
|
||||||
return
|
return
|
||||||
if os.path.exists(dst) and not os.path.islink(dst):
|
if not os.path.islink(dst) and os.path.exists(dst):
|
||||||
raise RuntimeError('Do not remove %s if it was not '
|
raise RuntimeError('Do not remove %s if it was not '
|
||||||
'installed by sugar', dst)
|
'installed by sugar', dst)
|
||||||
logging.debug('Link resource %s to %s', src, dst)
|
logging.debug('Link resource %s to %s', src, dst)
|
||||||
if os.path.exists(dst):
|
if os.path.lexists(dst):
|
||||||
logging.debug('Rewrite %s', dst)
|
logging.debug('Relink %s', dst)
|
||||||
os.unlink(dst)
|
os.unlink(dst)
|
||||||
os.symlink(src, dst)
|
os.symlink(src, dst)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user