Package: kupfer
Version: 0+v208-2
Severity: normal
Tags: patch, upstream

Dear maintainer,

$ LC_MESSAGES=en_GB.utf8 LC_NUMERIC=cs_CZ.utf8 kupfer
Kupfer: A free software (GPLv3+) launcher
        Copyright © 2007--2011 Ulrik Sverdrup with others
        http://kaizer.se/wiki/kupfer/

[kupfer.ui.browser] WindowController: Trying to register <Ctrl>space to spawn 
kupfer.. success
Traceback (most recent call last):
  File "/usr/share/kupfer/kupfer/utils.py", line 172, in _child_callback
    self.finish_callback(self, "".join(self.stdout), "".join(self.stderr))
  File "/usr/share/kupfer/kupfer/plugin/top.py", line 116, in 
_async_top_finished
    processes = sorted(processes, key=operator.itemgetter(4))
  File "/usr/share/kupfer/kupfer/plugin/top.py", line 182, in parse_top_output
    yield (int(pid), float(cpu), float(mem), ptime, cmd)
ValueError: invalid literal for float(): 42,2

If I select "Running Tasks" I get: "Running Tasks is empty".

Attached patch invokes top with LC_NUMERIC=C set in environment.

Cheers, Petr Gajdůšek

--- System information. ---
Architecture: amd64
Kernel:       Linux 3.2.0-3-amd64

Debian Release: wheezy/sid
  990 unstable        www.deb-multimedia.org 
  990 unstable        ftp.cz.debian.org 
  990 testing         ftp.cz.debian.org 
  600 experimental    ftp.cz.debian.org 
  500 testing         www.deb-multimedia.org 
  500 stable          deb.opera.com 

--- Package information. ---
Depends                  (Version) | Installed
==================================-+-==============
python               (>= 2.6.6-7~) | 2.7.3~rc2-1
python-gobject           (>= 2.18) | 3.2.2-1
python-gtk2              (>= 2.16) | 2.24.0-3
python-xdg                         | 0.19-4
python-dbus                        | 1.1.1-1
dbus                               | 1.6.2-1
python-keybinder                   | 0.2.2-4


Recommends          (Version) | Installed
=============================-+-===========
python-keyring                | 0.7.1-1
python-wnck                   | 2.32.0+dfsg-2+b1


Suggests             (Version) | Installed
==============================-+-===========
python-cjson                   | 1.0.5-4+b1
python-gdata                   | 2.0.17-1
python-qrencode                | 1.01-2+b1





-- 
S pozdravem,
Petr Gajdůšek
>From bdc3111790ba4d21c89914c182fd6f532f16ad75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Gajd=C5=AF=C5=A1ek?= <[email protected]>
Date: Mon, 2 Jul 2012 06:25:30 +0200
Subject: [PATCH 2/2] plugin top: fix for locales not using dot as decimal
 point.

---
 kupfer/plugin/top.py |    2 +-
 kupfer/utils.py      |    6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/kupfer/plugin/top.py b/kupfer/plugin/top.py
index 169135a..d410cec 100644
--- a/kupfer/plugin/top.py
+++ b/kupfer/plugin/top.py
@@ -126,7 +126,7 @@ class TaskSource(Source, PicklingHelperMixin):
 	def _async_top_start(self):
 		uid = os.getuid()
 		utils.AsyncCommand(["top", "-b", "-n", "1", "-u", "%d" % uid],
-		                   self._async_top_finished, 60)
+		                   self._async_top_finished, 60, env=["LC_NUMERIC=C"])
 
 	def get_items(self):
 		for task in self._cache:
diff --git a/kupfer/utils.py b/kupfer/utils.py
index ed6632d..b845b12 100644
--- a/kupfer/utils.py
+++ b/kupfer/utils.py
@@ -96,6 +96,8 @@ class AsyncCommand (object):
 
 	If stdin is a byte string, it is supplied on the command's stdin.
 
+	If env is None, command will inherit the parent's environment.
+
 	finish_callback -> (AsyncCommand, stdout_output, stderr_output)
 
 	Attributes:
@@ -106,7 +108,7 @@ class AsyncCommand (object):
 	# the maximum input (bytes) we'll read in one shot (one io_callback)
 	max_input_buf = 512 * 1024
 
-	def __init__(self, argv, finish_callback, timeout_s, stdin=None):
+	def __init__(self, argv, finish_callback, timeout_s, stdin=None, env=None):
 		self.stdout = []
 		self.stderr = []
 		self.stdin = []
@@ -121,7 +123,7 @@ class AsyncCommand (object):
 		flags = (glib.SPAWN_SEARCH_PATH | glib.SPAWN_DO_NOT_REAP_CHILD)
 		pid, stdin_fd, stdout_fd, stderr_fd = \
 		     glib.spawn_async(argv, standard_output=True, standard_input=True,
-		                      standard_error=True, flags=flags)
+		                      standard_error=True, flags=flags, envp=env)
 
 		if stdin:
 			self.stdin[:] = self._split_string(stdin, self.max_input_buf)
-- 
1.7.10

Reply via email to