[orca] Fix for bug 596359 - Should set the process name to "orca"



commit 1133b4385019684297eeffea6c441a8a9663bda5
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Feb 14 11:45:04 2012 -0500

    Fix for bug 596359 - Should set the process name to "orca"

 README           |    8 ++++----
 src/orca/orca.py |   25 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/README b/README
index d7540a0..0996b17 100644
--- a/README
+++ b/README
@@ -20,15 +20,14 @@ information on Orca, including how to run Orca, how to communicate
 with the Orca user community, and where to log bugs and feature
 requests.
 
-Build Requirements
+Dependencies
 ========================================================================
 
 Orca v3.3.x is supported on GNOME 3.3.x only.  We highly suggest you
 use the latest releases of GNOME because they contain accessibility
 infrastructure and application bug fixes that help Orca work better.
 
-Building Orca also requires the development modules for the following
-to be installed:
+Orca also has the following dependencies:
 
 * Python           - Python platform (minimum version 2.7)
 * pygobject-3.0    - Python bindings for the GObject library
@@ -38,12 +37,13 @@ to be installed:
 * python-speechd   - Python bindings for Speech Dispatcher (optional)
 * BrlTTY           - BrlTTY support for braille (optional)
 * BrlAPI           - BrlAPI support for braille (optional)
+* py-setproctitle  - Python library to set the process title (optional)
 
 YOU ALSO NEED THE LATEST AT-SPI AND ATK FOR THE GNOME 3.3.x DEVELOPMENT
 RELEASES.  THEY CONTAIN VERY IMPORTANT BUG FIXES!
 
 NOTE: If you have multiple versions of the python interpreter installed
-on your machine, you should set the PYTHON environment variable when 
+on your machine, you shhould set the PYTHON environment variable when 
 configuring Orca.  For example:
 
    PYTHON=/usr/bin/python2.7 ./autogen.sh
diff --git a/src/orca/orca.py b/src/orca/orca.py
index b9bcc35..00b68f6 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1310,6 +1310,29 @@ def showSplashGUI(script=None, inputEvent=None):
 #
 _initialized = False
 
+def setProcessName():
+    """Attempts to set the process name to 'orca'."""
+
+    # Disabling the import error of setproctitle.
+    # pylint: disable-msg=F0401
+    try:
+        from setproctitle import setproctitle
+    except ImportError:
+        pass
+    else:
+        setproctitle('orca')
+        return True
+
+    try:
+        from ctypes import cdll
+        libc = cdll.LoadLibrary('libc.so.6')
+        libc.prctl(15, 'orca', 0, 0, 0)
+        return True
+    except:
+        pass
+
+    return False
+
 def init(registry):
     """Initialize the orca module, which initializes the speech and braille
     modules.  Also builds up the application list, registers for AT-SPI events,
@@ -1351,6 +1374,8 @@ def start(registry):
     if not _initialized:
         init(registry)
 
+    setProcessName()
+
     # Do not hang on startup if we can help it.
     #
     if settings.timeoutCallback and (settings.timeoutTime > 0):



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