xcp_d.utils.filemanip

Miscellaneous file manipulation functions.

Functions

binarize_img(mask_file)

Binarize mask file.

check_binary_mask(mask_file)

Check if the mask is binary.

copyfile(originalfile, newfile[, copy, ...])

Copy or link originalfile to newfile.

copyfiles(filelist, dest[, copy, create_new])

Copy or symlink files in filelist to dest directory.

ensure_list(filename)

Return a list given either a string or a list.

fname_presuffix(fname[, prefix, suffix, ...])

Manipulate path and name of input filename.

get_related_files(filename[, include_this_file])

Return a list of related files, as defined in related_filetype_sets, for a filename.

hash_infile(afile[, chunk_len, crypto, ...])

Compute hash of a file using 'crypto' module.

hash_timestamp(afile)

Compute md5 hash of the timestamp of a file.

on_cifs(fname)

Check whether a file path is on a CIFS filesystem mounted in a POSIX host.

relpath(path[, start])

Return a relative version of a path.

split_filename(fname)

Split a filename into parts: path, base filename and extension.

which(cmd[, env, pathext])

Return the path to an executable which would be run if the given cmd was called.