1
''' Helper for managing alternatives for file conflict resolution '''
8
def install_alternative(name, target, source, priority=50):
9
''' Install alternative configuration '''
10
if (os.path.exists(target) and not os.path.islink(target)):
11
# Move existing file/directory away before installing
12
shutil.move(target, '{}.bak'.format(target))
14
'update-alternatives', '--force', '--install',
15
target, name, source, str(priority)
17
subprocess.check_call(cmd)