|  | @@ -15,13 +15,17 @@ def symlink(source, link_name, relative = False, override = False, backup = True
 | 
	
		
			
				|  |  |          source = os.path.relpath(source, os.path.dirname(link_name))
 | 
	
		
			
				|  |  |      # os.path.lexists() returns True if path refers to an existing path and 
 | 
	
		
			
				|  |  |      # True for broken symbolic links. 
 | 
	
		
			
				|  |  | -    if override and os.path.lexists(link_name):
 | 
	
		
			
				|  |  | -        if backup:
 | 
	
		
			
				|  |  | -            append_to_name(link_name, backup_suffix)
 | 
	
		
			
				|  |  | -        else:
 | 
	
		
			
				|  |  | -            if os.path.isdir(link_name):
 | 
	
		
			
				|  |  | -                os.rmdir(link_name)
 | 
	
		
			
				|  |  | -            else:
 | 
	
		
			
				|  |  | -                os.remove(link_name)
 | 
	
		
			
				|  |  | -    if not os.path.lexists(link_name) or os.readlink(link_name) != source:
 | 
	
		
			
				|  |  | +    if not os.path.lexists(link_name):
 | 
	
		
			
				|  |  |          os.symlink(source, link_name)
 | 
	
		
			
				|  |  | +    elif not os.path.islink(link_name) or os.readlink(link_name) != source:
 | 
	
		
			
				|  |  | +        if override:
 | 
	
		
			
				|  |  | +            if backup:
 | 
	
		
			
				|  |  | +                append_to_name(link_name, backup_suffix)
 | 
	
		
			
				|  |  | +            else:
 | 
	
		
			
				|  |  | +                if os.path.isdir(link_name):
 | 
	
		
			
				|  |  | +                    os.rmdir(link_name)
 | 
	
		
			
				|  |  | +                else:
 | 
	
		
			
				|  |  | +                    os.remove(link_name)
 | 
	
		
			
				|  |  | +            os.symlink(source, link_name)
 | 
	
		
			
				|  |  | +        else:
 | 
	
		
			
				|  |  | +            raise OSError("link's path '%s' already exists." % link_name)
 |