[kupfer] Use setproctitle when available to set process name



commit 3a025a622ca40bfefaf4d806501be70ed7689894
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Wed Jun 2 13:45:27 2010 +0200

    Use setproctitle when available to set process name
    
    Include note in README

 README         |    7 +++++++
 kupfer/main.py |   11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/README b/README
index 50725e3..2da653b 100644
--- a/README
+++ b/README
@@ -53,6 +53,13 @@ Optional, but very recommended dependencies:
 * xml2po / gnome docutils  to install mallard help pages
 * python-keyring-gnome or python-keyring-kwallet
 
+Opportunistic dependencies
+
+* The deprecated 'gnome' module is used for session connection as
+  fallback
+* If available, 'setproctitle' is used to set the process name
+
+
 Some plugins might require additional python modules!
 
 Spawning
diff --git a/kupfer/main.py b/kupfer/main.py
index 5a64fec..f605add 100644
--- a/kupfer/main.py
+++ b/kupfer/main.py
@@ -123,6 +123,15 @@ def _set_process_title_linux():
 	except (AttributeError, OSError):
 		pass
 
+def _set_process_title():
+	try:
+		import setproctitle
+	except ImportError:
+		if sys.platform == "linux2":
+			_set_process_title_linux()
+	else:
+		setproctitle.setproctitle("kupfer")
+
 def main():
 	# parse commandline before importing UI
 	cli_opts = get_options()
@@ -139,7 +148,7 @@ def main():
 		except ImportError, e:
 			pass
 	sys.excepthook = sys.__excepthook__
-	_set_process_title_linux()
+	_set_process_title()
 
 	w = browser.WindowController()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]