Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 914948 Details for
Bug 1116544
[i18n] double width Unicode characters
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
fixed output.
output.py.patch (text/plain), 21.38 KB, created by
Takayuki Ogawa
on 2014-07-06 11:04:49 UTC
(
hide
)
Description:
fixed output.
Filename:
MIME Type:
Creator:
Takayuki Ogawa
Created:
2014-07-06 11:04:49 UTC
Size:
21.38 KB
patch
obsolete
>*** /usr/lib/python2.7/site-packages/dnf/cli/output.py.orig 2014-05-28 17:27:24.000000000 +0900 >--- /usr/lib/python2.7/site-packages/dnf/cli/output.py 2014-07-06 19:50:18.389298733 +0900 >*************** >*** 26,37 **** > import logging > import pwd > import re >- import textwrap > > import dnf.callback > import dnf.cli.progress > import dnf.conf >! from dnf.i18n import _, P_, ucd, fill_exact_width > from dnf.yum.misc import prco_tuple_to_string > import dnf.yum.misc > >--- 26,36 ---- > import logging > import pwd > import re > > import dnf.callback > import dnf.cli.progress > import dnf.conf >! from dnf.i18n import _, P_, ucd, exact_width, fill_exact_width, textwrap_fill > from dnf.yum.misc import prco_tuple_to_string > import dnf.yum.misc > >*************** >*** 638,644 **** > to len() if you know it'll be fine > :return: a row of data formatted into a string for output > """ >! total_width = len(msg) > data = [] > for col_data in columns[:-1]: > (val, width, hibeg, hiend) = self._col_data(col_data) >--- 637,643 ---- > to len() if you know it'll be fine > :return: a row of data formatted into a string for output > """ >! total_width = exact_width(msg) > data = [] > for col_data in columns[:-1]: > (val, width, hibeg, hiend) = self._col_data(col_data) >*************** >*** 649,655 **** > continue > > (align, width) = self._fmt_column_align_width(width) >! val_width = len(val) > if val_width <= width: > # Don't use utf8_width_fill() because it sucks performance > # wise for 1,000s of rows. Also allows us to use len(), when >--- 648,654 ---- > continue > > (align, width) = self._fmt_column_align_width(width) >! val_width = exact_width(val) > if val_width <= width: > # Don't use utf8_width_fill() because it sucks performance > # wise for 1,000s of rows. Also allows us to use len(), when >*************** >*** 727,745 **** > :param val: the value associated with *key* > :return: the key value pair formatted in two columns for output > """ >! keylen = len(key) > cols = self.term.columns >! nxt = ' ' * (keylen - 2) + ': ' > if not val: > # textwrap.fill in case of empty val returns empty string > return key > val = ucd(val) >! ret = textwrap.fill(val, width=cols, initial_indent=key, > subsequent_indent=nxt) > if ret.count("\n") > 1 and keylen > (cols // 3): > # If it's big, redo it again with a smaller subsequent off >! ret = textwrap.fill(val, width=cols, initial_indent=key, >! subsequent_indent=' ...: ') > return ret > > def fmtSection(self, name, fill='='): >--- 726,744 ---- > :param val: the value associated with *key* > :return: the key value pair formatted in two columns for output > """ >! keylen = exact_width(key) > cols = self.term.columns >! nxt = ucd(' ' * (keylen - 2) + ': ') > if not val: > # textwrap.fill in case of empty val returns empty string > return key > val = ucd(val) >! ret = textwrap_fill(val, width=cols, initial_indent=key, > subsequent_indent=nxt) > if ret.count("\n") > 1 and keylen > (cols // 3): > # If it's big, redo it again with a smaller subsequent off >! ret = textwrap_fill(val, width=cols, initial_indent=key, >! subsequent_indent=ucd(' ...: ')) > return ret > > def fmtSection(self, name, fill='='): >*************** >*** 754,760 **** > """ > name = ucd(name) > cols = self.term.columns - 2 >! name_len = len(name) > if name_len >= (cols - 4): > beg = end = fill * 2 > else: >--- 753,759 ---- > """ > name = ucd(name) > cols = self.term.columns - 2 >! name_len = exact_width(name) > if name_len >= (cols - 4): > beg = end = fill * 2 > else: >*************** >*** 1318,1326 **** > continue > > msg_pkgs = P_('Package', 'Packages', count) >! len_msg_action = len(action) > len_msg_count = len(str(count)) >! len_msg_pkgs = len(msg_pkgs) > > if depcount: > len_msg_depcount = len(str(depcount)) >--- 1317,1325 ---- > continue > > msg_pkgs = P_('Package', 'Packages', count) >! len_msg_action = exact_width(action) > len_msg_count = len(str(count)) >! len_msg_pkgs = exact_width(msg_pkgs) > > if depcount: > len_msg_depcount = len(str(depcount)) >*************** >*** 1337,1348 **** > if depcount: > msg_deppkgs = P_('Dependent package', 'Dependent packages', > depcount) >! action_msg = "%-*s" % (max_msg_action, action) > if count: > msg = '%s %*d %s (+%*d %s)\n' > out.append(msg % (action_msg, > max_msg_count, count, >! "%-*s" % (max_msg_pkgs, msg_pkgs), > max_msg_depcount, depcount, msg_deppkgs)) > else: > msg = '%s %s ( %*d %s)\n' >--- 1336,1347 ---- > if depcount: > msg_deppkgs = P_('Dependent package', 'Dependent packages', > depcount) >! action_msg = fill_exact_width(action, max_msg_action, discard_over_width=False) > if count: > msg = '%s %*d %s (+%*d %s)\n' > out.append(msg % (action_msg, > max_msg_count, count, >! fill_exact_width(msg_pkgs, max_msg_pkgs, discard_over_width=False), > max_msg_depcount, depcount, msg_deppkgs)) > else: > msg = '%s %s ( %*d %s)\n' >*************** >*** 1351,1357 **** > max_msg_depcount, depcount, msg_deppkgs)) > elif count: > msg = '%s %*d %s\n' >! out.append(msg % ("%-*s" % (max_msg_action, action), > max_msg_count, count, msg_pkgs)) > return ''.join(out) > >--- 1350,1356 ---- > max_msg_depcount, depcount, msg_deppkgs)) > elif count: > msg = '%s %*d %s\n' >! out.append(msg % (fill_exact_width(action, max_msg_action, discard_over_width=False), > max_msg_count, count, msg_pkgs)) > return ''.join(out) > >*************** >*** 1377,1388 **** > col_lens = [0] * num > col = 0 > for msg in msgs: >! if len(msg) > col_lens[col]: >! diff = (len(msg) - col_lens[col]) > if left <= diff: > return [] > left -= diff >! col_lens[col] = len(msg) > col += 1 > col %= len(col_lens) > >--- 1376,1387 ---- > col_lens = [0] * num > col = 0 > for msg in msgs: >! if exact_width(msg) > col_lens[col]: >! diff = (exact_width(msg) - col_lens[col]) > if left <= diff: > return [] > left -= diff >! col_lens[col] = exact_width(msg) > col += 1 > col %= len(col_lens) > >*************** >*** 1454,1460 **** > format_number(remote_size // dl_time), > format_number(remote_size), > format_time(dl_time)) >! msg = "%-*s" % (width - len(msg), _("Total")) + msg > self.logger.info(msg) > > def _history_uiactions(self, hpkgs): >--- 1453,1459 ---- > format_number(remote_size // dl_time), > format_number(remote_size), > format_time(dl_time)) >! msg = fill_exact_width(_("Total"), width - exact_width(msg)) + msg > self.logger.info(msg) > > def _history_uiactions(self, hpkgs): >*************** >*** 1496,1502 **** > if uid is None or uid in (0xFFFFFFFF, 0x7FFFFFFF): > loginid = _("<unset>") > name = _("System") + " " + loginid >! if limit is not None and len(name) > limit: > name = loginid > return ucd(name) > >--- 1495,1501 ---- > if uid is None or uid in (0xFFFFFFFF, 0x7FFFFFFF): > loginid = _("<unset>") > name = _("System") + " " + loginid >! if limit is not None and exact_width(name) > limit: > name = loginid > return ucd(name) > >*************** >*** 1512,1520 **** > user = pwd.getpwuid(uid) > fullname = _safe_split_0(user.pw_gecos, ';', 2) > name = "%s <%s>" % (fullname, user.pw_name) >! if limit is not None and len(name) > limit: > name = "%s ... <%s>" % (_safe_split_0(fullname), user.pw_name) >! if len(name) > limit: > name = "<%s>" % user.pw_name > return ucd(name) > except KeyError: >--- 1511,1519 ---- > user = pwd.getpwuid(uid) > fullname = _safe_split_0(user.pw_gecos, ';', 2) > name = "%s <%s>" % (fullname, user.pw_name) >! if limit is not None and exact_width(ucd(name)) > limit: > name = "%s ... <%s>" % (_safe_split_0(fullname), user.pw_name) >! if exact_width(ucd(name)) > limit: > name = "<%s>" % user.pw_name > return ucd(name) > except KeyError: >*************** >*** 1651,1658 **** > name = _("Login user") > print(fmt % (fill_exact_width(_("ID"), 6), > fill_exact_width(name, 24), >! fill_exact_width(_("Date and time"), 6), >! fill_exact_width(_("Action(s)"), 6), > fill_exact_width(_("Altered"), 6))) > print("-" * 79) > fmt = "%6u | %s | %-16.16s | %s | %4u" >--- 1650,1657 ---- > name = _("Login user") > print(fmt % (fill_exact_width(_("ID"), 6), > fill_exact_width(name, 24), >! fill_exact_width(_("Date and time"), 16), >! fill_exact_width(_("Action(s)"), 14), > fill_exact_width(_("Altered"), 6))) > print("-" * 79) > fmt = "%6u | %s | %-16.16s | %s | %4u" >*************** >*** 1803,1809 **** > 'o' : _('Upgraded'), 'n' : _('Downgraded')} > _pkg_states_available = {'i' : _('Installed'), 'e' : _('Not installed'), > 'o' : _('Older'), 'n' : _('Newer')} >! maxlen = max([len(x) for x in (list(_pkg_states_installed.values()) + > list(_pkg_states_available.values()))]) > _pkg_states_installed['maxlen'] = maxlen > _pkg_states_available['maxlen'] = maxlen >--- 1802,1808 ---- > 'o' : _('Upgraded'), 'n' : _('Downgraded')} > _pkg_states_available = {'i' : _('Installed'), 'e' : _('Not installed'), > 'o' : _('Older'), 'n' : _('Newer')} >! maxlen = max([exact_width(x) for x in (list(_pkg_states_installed.values()) + > list(_pkg_states_available.values()))]) > _pkg_states_installed['maxlen'] = maxlen > _pkg_states_available['maxlen'] = maxlen >*************** >*** 1831,1842 **** > (hibeg, hiend) = self._highlight('bold') > else: > (hibeg, hiend) = self._highlight('normal') >! state = "%-*s" % (_pkg_states['maxlen'], state) > ui_repo = '' > if show_repo: > ui_repo = self._hpkg2from_repo(hpkg) >! print("%s%s%s%s %-*s %s" % (prefix, hibeg, state, hiend, >! pkg_max_len, hpkg, ui_repo)) > > if isinstance(old.tid, list): > print(_("Transaction ID :"), "%u..%u" % (old.tid[0], old.tid[-1])) >--- 1830,1841 ---- > (hibeg, hiend) = self._highlight('bold') > else: > (hibeg, hiend) = self._highlight('normal') >! state = fill_exact_width(state, _pkg_states['maxlen'], discard_over_width=False) > ui_repo = '' > if show_repo: > ui_repo = self._hpkg2from_repo(hpkg) >! print("%s%s%s%s %s %s" % (prefix, hibeg, state, hiend, >! fill_exact_width(ucd(hpkg), pkg_max_len, discard_over_width=False), ui_repo)) > > if isinstance(old.tid, list): > print(_("Transaction ID :"), "%u..%u" % (old.tid[0], old.tid[-1])) >*************** >*** 1916,1922 **** > if old.trans_with: > # This is _possible_, but not common > print(_("Transaction performed with:")) >! pkg_max_len = max((len(str(hpkg)) for hpkg in old.trans_with)) > for hpkg in old.trans_with: > _simple_pkg(hpkg, 4, was_installed=True, pkg_max_len=pkg_max_len) > print(_("Packages Altered:")) >--- 1915,1921 ---- > if old.trans_with: > # This is _possible_, but not common > print(_("Transaction performed with:")) >! pkg_max_len = max((exact_width(ucd(hpkg)) for hpkg in old.trans_with)) > for hpkg in old.trans_with: > _simple_pkg(hpkg, 4, was_installed=True, pkg_max_len=pkg_max_len) > print(_("Packages Altered:")) >*************** >*** 1924,1930 **** > > if old.trans_skip: > print(_("Packages Skipped:")) >! pkg_max_len = max((len(str(hpkg)) for hpkg in old.trans_skip)) > for hpkg in old.trans_skip: > # Don't show the repo. here because we can't store it as they were, > # by definition, not installed. >--- 1923,1929 ---- > > if old.trans_skip: > print(_("Packages Skipped:")) >! pkg_max_len = max((exact_width(ucd(hpkg)) for hpkg in old.trans_skip)) > for hpkg in old.trans_skip: > # Don't show the repo. here because we can't store it as they were, > # by definition, not installed. >*************** >*** 1936,1942 **** > key = "%s%s: " % (" " * 4, prob.problem) > print(self.fmtKeyValFill(key, prob.text)) > if prob.packages: >! pkg_max_len = max((len(str(hpkg)) for hpkg in prob.packages)) > for hpkg in prob.packages: > _simple_pkg(hpkg, 8, was_installed=True, highlight=hpkg.main, > pkg_max_len=pkg_max_len) >--- 1935,1941 ---- > key = "%s%s: " % (" " * 4, prob.problem) > print(self.fmtKeyValFill(key, prob.text)) > if prob.packages: >! pkg_max_len = max((exact_width(ucd(hpkg)) for hpkg in prob.packages)) > for hpkg in prob.packages: > _simple_pkg(hpkg, 8, was_installed=True, highlight=hpkg.main, > pkg_max_len=pkg_max_len) >*************** >*** 1983,1992 **** > pkg_max_len = 0 > for hpkg in old.trans_data: > uistate = all_uistates.get(hpkg.state, hpkg.state) >! if maxlen < len(uistate): >! maxlen = len(uistate) >! if pkg_max_len < len(str(hpkg)): >! pkg_max_len = len(str(hpkg)) > > for hpkg in old.trans_data: > prefix = " " * 4 >--- 1982,1991 ---- > pkg_max_len = 0 > for hpkg in old.trans_data: > uistate = all_uistates.get(hpkg.state, hpkg.state) >! if maxlen < exact_width(uistate): >! maxlen = exact_width(uistate) >! if pkg_max_len < exact_width(ucd(hpkg)): >! pkg_max_len = exact_width(ucd(hpkg)) > > for hpkg in old.trans_data: > prefix = " " * 4 >*************** >*** 2005,2011 **** > cn = hpkg.ui_nevra > > uistate = all_uistates.get(hpkg.state, hpkg.state) >! uistate = "%-*s" % (maxlen, uistate) > # Should probably use columns here... > if False: pass > elif (last is not None and >--- 2004,2010 ---- > cn = hpkg.ui_nevra > > uistate = all_uistates.get(hpkg.state, hpkg.state) >! uistate = fill_exact_width(uistate, maxlen, discard_over_width=False) > # Should probably use columns here... > if False: pass > elif (last is not None and >*************** >*** 2193,2199 **** > continue > > uistate = all_uistates.get(hpkg.state, hpkg.state) >! uistate = "%-*s" % (14, uistate) > > # To chop the name off we need nevra strings, str(pkg) gives > # envra so we have to do it by hand ... *sigh*. >--- 2192,2198 ---- > continue > > uistate = all_uistates.get(hpkg.state, hpkg.state) >! uistate = fill_exact_width(uistate, 14, discard_over_width=False) > > # To chop the name off we need nevra strings, str(pkg) gives > # envra so we have to do it by hand ... *sigh*. >*************** >*** 2397,2403 **** > if not hasattr(self, '_max_action_wid_cache'): > wid1 = 0 > for val in self.action.values(): >! wid_val = len(val) > if wid1 < wid_val: > wid1 = wid_val > self._max_action_wid_cache = wid1 >--- 2396,2402 ---- > if not hasattr(self, '_max_action_wid_cache'): > wid1 = 0 > for val in self.action.values(): >! wid_val = exact_width(val) > if wid1 < wid_val: > wid1 = wid_val > self._max_action_wid_cache = wid1 >*************** >*** 2411,2418 **** > progress=sys.stdout.isatty(), > pkgname=pkgname, wid1=wid1) > pkgname = ucd(pkgname) >! msg = fmt % ("%-*.*s" % (wid1, wid1, process), >! "%-*.*s" % (wid2, wid2, pkgname)) > if msg != self.lastmsg: > sys.stdout.write(msg) > sys.stdout.flush() >--- 2410,2417 ---- > progress=sys.stdout.isatty(), > pkgname=pkgname, wid1=wid1) > pkgname = ucd(pkgname) >! msg = fmt % (fill_exact_width(process, wid1), >! fill_exact_width(pkgname, wid2)) > if msg != self.lastmsg: > sys.stdout.write(msg) > sys.stdout.flush() >*************** >*** 2441,2447 **** > if pkgname is None: > pnl = 22 > else: >! pnl = len(pkgname) > > overhead = (2 * l) + 2 # Length of done, above > overhead += 2+ wid1 +2 # Length of beginning (" " action " :") >--- 2440,2446 ---- > if pkgname is None: > pnl = 22 > else: >! pnl = exact_width(pkgname) > > overhead = (2 * l) + 2 # Length of done, above > overhead += 2+ wid1 +2 # Length of beginning (" " action " :") >*************** >*** 2480,2486 **** > def verify_tsi_package(self, pkg, count, total): > percent = 100 > process = _('Verifying') >! wid1 = max(len(process), self._max_action_width()) > self._out_event(100, 100, count, total, percent, process, str(pkg), wid1) > > def progressbar(current, total, name=None): >--- 2479,2485 ---- > def verify_tsi_package(self, pkg, count, total): > percent = 100 > process = _('Verifying') >! wid1 = max(exact_width(process), self._max_action_width()) > self._out_event(100, 100, count, total, percent, process, str(pkg), wid1) > > def progressbar(current, total, name=None): >*************** >*** 2510,2519 **** > width = _term_width() > > if name is None and current == total: >! name = '-' > > end = ' %d/%d' % (current, total) >! width -= len(end) + 1 > if width < 0: > width = 0 > if name is None: >--- 2509,2518 ---- > width = _term_width() > > if name is None and current == total: >! name = ucd('-') > > end = ' %d/%d' % (current, total) >! width -= exact_width(ucd(end)) + 1 > if width < 0: > width = 0 > if name is None: >*************** >*** 2529,2536 **** > if width < 0: > width = 0 > nwid = width // 2 >! if nwid > len(name): >! nwid = len(name) > width -= nwid > hashbar = mark * int(width * percent) > output = '\r%s: [%-*s]%s' % (fill_exact_width(name, nwid), width, >--- 2528,2535 ---- > if width < 0: > width = 0 > nwid = width // 2 >! if nwid > exact_width(name): >! nwid = exact_width(name) > width -= nwid > hashbar = mark * int(width * percent) > output = '\r%s: [%-*s]%s' % (fill_exact_width(name, nwid), width,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1116544
:
914946
|
914947
| 914948 |
914953