def hardlink_if_possible(fullname, node, meta):
 global targets_written
 target = meta.hardlink_target
 target_versions = targets_written.get(target)
 if target_versions:
  for (target_path, target_vfs_path, target_meta) in target_versions:
   if hardlink_compatible(target_path, target_vfs_path, target_meta, node, meta):
    try:
     os.link(target_path, fullname)
     return True
    except OSError as e:
     if (e.errno != errno.EXDEV):
      raise
 else:
  target_versions = []
  targets_written[target] = target_versions
 full_vfs_path = node.fullname()
 target_versions.append((fullname, full_vfs_path, meta))
 return False

def hardlink_if_possible ( fullname , node , meta ) : global targets_written target = meta . hardlink_target target_versions = targets_written . get ( target ) if target_versions : for ( target_path , target_vfs_path , target_meta ) in target_versions : if hardlink_compatible ( target_path , target_vfs_path , target_meta , node , meta ) : try : os . link ( target_path , fullname ) return True except OSError as e : if ( e . errno != errno . EXDEV ) : raise else : target_versions = [ ] targets_written [ target ] = target_versions full_vfs_path = node . fullname ( ) target_versions . append ( ( fullname , full_vfs_path , meta ) ) return False
find a suitable hardlink target .