Add --debug and --verbose options to launcher scripts
Factor out a common Launcher class from start-in-Xepyhr and start-replace that handles option parsing and launching gnome-shell, and add options: -v/--verbose: Unless specified, suppress most gjs debug output -g/--debug: If specified run under gdb --debug-command: Run under some other debugging (strace/valgrind/etc.) Implies -g svn path=/trunk/; revision=18
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import os,sys,subprocess,signal
|
||||
import random
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import os
|
||||
import subprocess
|
||||
import signal
|
||||
|
||||
# Uninstalled paths
|
||||
scripts_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
top_dir = os.path.dirname(scripts_dir)
|
||||
plugin_dir = os.path.join(top_dir, "src")
|
||||
plugin = os.path.join(plugin_dir, "libgnome-shell.la")
|
||||
js_dir = os.path.join(top_dir, "js")
|
||||
from launcher import Launcher
|
||||
|
||||
launcher = Launcher()
|
||||
|
||||
try:
|
||||
# Kill gnome-panel in a way that it won't autorespawn
|
||||
@@ -26,39 +21,14 @@ try:
|
||||
"-p", pid], stdout=devnull, stderr=devnull)
|
||||
devnull.close()
|
||||
|
||||
# Check if GLX supports GL_ARB_texture_non_power_of_two; currently clutter
|
||||
# can only use GLX_EXT_texture_for_pixmap if we have that extension.
|
||||
glxinfo = subprocess.Popen(["glxinfo"], stdout=subprocess.PIPE)
|
||||
glxinfo_output = glxinfo.communicate()[0]
|
||||
glxinfo.wait()
|
||||
|
||||
have_npot_textures = "GL_ARB_texture_non_power_of_two" in glxinfo_output
|
||||
shell = launcher.start_shell()
|
||||
|
||||
# Now launch metacity-clutter with our plugin
|
||||
env=dict(os.environ)
|
||||
env.update({'GNOME_SHELL_JS' : js_dir,
|
||||
'GI_TYPELIB_PATH' : plugin_dir,
|
||||
'LD_LIBRARY_PATH' : os.environ.get('LD_LIBRARY_PATH', '') + ':' + plugin_dir})
|
||||
|
||||
if have_npot_textures:
|
||||
# If we have NPOT textures, then we want to use GLX_EXT_texture_from_pixmap; in
|
||||
# most cases, we have to force indirect rendering to do this. DRI2 will lift
|
||||
# that restriction; in which case what we should do is parse the information
|
||||
# from glxinfo more carefully... if the extension isn't listed under
|
||||
# "GLX extensions" with LIBGL_ALWAYS_INDIRECT unset, then set LIBGL_ALWAYS_INDIRECT
|
||||
# and try again.
|
||||
env['LIBGL_ALWAYS_INDIRECT'] = '1'
|
||||
|
||||
args = 'DEBUG' in os.environ and os.environ['DEBUG'].split() or []
|
||||
args.extend(['metacity', '--mutter-plugins=' + plugin, '--replace'])
|
||||
metacity = subprocess.Popen(args, env=env)
|
||||
|
||||
# Wait for metacity to exit
|
||||
# Wait for shell to exit
|
||||
try:
|
||||
metacity.wait()
|
||||
shell.wait()
|
||||
except KeyboardInterrupt, e:
|
||||
os.kill(metacity.pid, signal.SIGKILL)
|
||||
metacity.wait()
|
||||
os.kill(shell.pid, signal.SIGKILL)
|
||||
shell.wait()
|
||||
finally:
|
||||
# Restart gnome-panel and window manager
|
||||
|
||||
|
Reference in New Issue
Block a user