def symlinks_supported():
 tmpdir = tempfile.mkdtemp()
 original_path = os.path.join(tmpdir, 'original')
 symlink_path = os.path.join(tmpdir, 'symlink')
 os.makedirs(original_path)
 try:
  os.symlink(original_path, symlink_path)
  supported = True
 except (OSError, NotImplementedError, AttributeError):
  supported = False
 else:
  os.remove(symlink_path)
 finally:
  os.rmdir(original_path)
  os.rmdir(tmpdir)
  return supported

def symlinks_supported ( ) : tmpdir = tempfile . mkdtemp ( ) original_path = os . path . join ( tmpdir , 'original' ) symlink_path = os . path . join ( tmpdir , 'symlink' ) os . makedirs ( original_path ) try : os . symlink ( original_path , symlink_path ) supported = True except ( OSError , NotImplementedError , AttributeError ) : supported = False else : os . remove ( symlink_path ) finally : os . rmdir ( original_path ) os . rmdir ( tmpdir ) return supported
a function to check if creating symlinks are supported in the host platform and/or if they are allowed to be created .