0007851: Handle column width voodoo in yum output
Migrated from: https://tracker.clearos.com/view.php?id=7851
Reported by: PBaldwin
The column widths used by yum use a lot of voodoo. This makes it hard to parse its output in a reasonable way. It would be nice if line wrapping could be disabled -- is that possible? Regardless, the dynamic line wrapping is causing grief for the install wizard and potentially other API calls.
Here's the source code comments on the voodoo.
def calcColumns(self, data, columns=None, remainder_column=0, total_width=None, indent=''): """Dynamically calculate the widths of the columns that the fields in data should be placed into for output. :param data: a list of dictionaries that represent the data to be output. Each dictionary in the list corresponds to a column of output. The keys of the dictionary are the lengths of the items to be output, and the value associated with a key is the number of items of that length. :param columns: a list containing the minimum amount of space that must be allocated for each row. This can be used to ensure that there is space available in a column if, for example, the actual lengths of the items being output cannot be given in *data* :param remainder_column: number of the column to receive a few extra spaces that may remain after other allocation has taken place :param total_width: the total width of the output. self.term.columns is used by default :param indent: string that will be prefixed to a line of output to create e.g. an indent :return: a list of the widths of the columns that the fields in data should be placed into for output