* [gentoo-portage-dev] [PATCH] localization: properly decode formatted number for localized_size().
@ 2014-08-06 16:33 Michał Górny
2014-08-06 16:54 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
2014-08-06 20:22 ` [gentoo-portage-dev] [PATCH] " Brian Dolbec
0 siblings, 2 replies; 4+ messages in thread
From: Michał Górny @ 2014-08-06 16:33 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=519124
---
pym/portage/localization.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pym/portage/localization.py b/pym/portage/localization.py
index e4d87b6..cd21567 100644
--- a/pym/portage/localization.py
+++ b/pym/portage/localization.py
@@ -36,4 +36,5 @@ def localized_size(num_bytes):
# always round up, so that small files don't end up as '0 KiB'
num_kib = math.ceil(num_bytes / 1024)
- return locale.format('%d', num_kib, grouping=True) + ' KiB'
+ return (_unicode_decode(locale.format('%d', num_kib, grouping=True))
+ + ' KiB')
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-portage-dev] [PATCH v2] localization: properly decode formatted number for localized_size().
2014-08-06 16:33 [gentoo-portage-dev] [PATCH] localization: properly decode formatted number for localized_size() Michał Górny
@ 2014-08-06 16:54 ` Michał Górny
2014-08-06 20:23 ` Brian Dolbec
2014-08-06 20:22 ` [gentoo-portage-dev] [PATCH] " Brian Dolbec
1 sibling, 1 reply; 4+ messages in thread
From: Michał Górny @ 2014-08-06 16:54 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Fixes: https://bugs.gentoo.org/show_bug.cgi?id=519124
---
pym/portage/localization.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/portage/localization.py b/pym/portage/localization.py
index e4d87b6..7d30b59 100644
--- a/pym/portage/localization.py
+++ b/pym/portage/localization.py
@@ -5,7 +5,7 @@
import locale
import math
-from portage import _unicode_decode
+from portage import _encodings, _unicode_decode
# We define this to make the transition easier for us.
def _(mystr):
@@ -36,4 +36,5 @@ def localized_size(num_bytes):
# always round up, so that small files don't end up as '0 KiB'
num_kib = math.ceil(num_bytes / 1024)
- return locale.format('%d', num_kib, grouping=True) + ' KiB'
+ formatted_num = locale.format('%d', num_kib, grouping=True)
+ return (_unicode_decode(formatted_num, encoding=_encodings['stdio']) + ' KiB')
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] localization: properly decode formatted number for localized_size().
2014-08-06 16:33 [gentoo-portage-dev] [PATCH] localization: properly decode formatted number for localized_size() Michał Górny
2014-08-06 16:54 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
@ 2014-08-06 20:22 ` Brian Dolbec
1 sibling, 0 replies; 4+ messages in thread
From: Brian Dolbec @ 2014-08-06 20:22 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, 6 Aug 2014 18:33:08 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> Fixes: https://bugs.gentoo.org/show_bug.cgi?id=519124
> ---
> pym/portage/localization.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/pym/portage/localization.py b/pym/portage/localization.py
> index e4d87b6..cd21567 100644
> --- a/pym/portage/localization.py
> +++ b/pym/portage/localization.py
> @@ -36,4 +36,5 @@ def localized_size(num_bytes):
>
> # always round up, so that small files don't end up as '0
> KiB' num_kib = math.ceil(num_bytes / 1024)
> - return locale.format('%d', num_kib, grouping=True) + ' KiB'
> + return (_unicode_decode(locale.format('%d', num_kib,
> grouping=True))
> + + ' KiB')
OK, commit this one. mark the bug inVCS, add it to the tracker bug.
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-portage-dev] [PATCH v2] localization: properly decode formatted number for localized_size().
2014-08-06 16:54 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
@ 2014-08-06 20:23 ` Brian Dolbec
0 siblings, 0 replies; 4+ messages in thread
From: Brian Dolbec @ 2014-08-06 20:23 UTC (permalink / raw
To: gentoo-portage-dev
On Wed, 6 Aug 2014 18:54:22 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> Fixes: https://bugs.gentoo.org/show_bug.cgi?id=519124
> ---
> pym/portage/localization.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/pym/portage/localization.py b/pym/portage/localization.py
> index e4d87b6..7d30b59 100644
> --- a/pym/portage/localization.py
> +++ b/pym/portage/localization.py
> @@ -5,7 +5,7 @@
> import locale
> import math
>
> -from portage import _unicode_decode
> +from portage import _encodings, _unicode_decode
>
> # We define this to make the transition easier for us.
> def _(mystr):
> @@ -36,4 +36,5 @@ def localized_size(num_bytes):
>
> # always round up, so that small files don't end up as '0
> KiB' num_kib = math.ceil(num_bytes / 1024)
> - return locale.format('%d', num_kib, grouping=True) + ' KiB'
> + formatted_num = locale.format('%d', num_kib, grouping=True)
> + return (_unicode_decode(formatted_num,
> encoding=_encodings['stdio']) + ' KiB')
DOH, repliied to the wrong one... this is the one I meant.
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-08-06 20:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-06 16:33 [gentoo-portage-dev] [PATCH] localization: properly decode formatted number for localized_size() Michał Górny
2014-08-06 16:54 ` [gentoo-portage-dev] [PATCH v2] " Michał Górny
2014-08-06 20:23 ` Brian Dolbec
2014-08-06 20:22 ` [gentoo-portage-dev] [PATCH] " Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox