From 254efdd122f56176bfa1ddd97dc77d938cf0094e Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Fri, 16 Aug 2013 15:07:03 +0200 Subject: [PATCH] Remove the jhbuild wrapper script It's mostly equivalent to "jhbuild run gnome-shell", which is the preferred way. Also, running from the source tree can't be supported at this point, and the wrapper is getting in the way of having two binaries, one for wayland and one for X11. https://bugzilla.gnome.org/show_bug.cgi?id=705497 --- configure.ac | 4 - src/Makefile.am | 32 ++----- src/gnome-shell-jhbuild.in | 175 ------------------------------------- 3 files changed, 5 insertions(+), 206 deletions(-) delete mode 100755 src/gnome-shell-jhbuild.in diff --git a/configure.ac b/configure.ac index 132910ce3..943061be3 100644 --- a/configure.ac +++ b/configure.ac @@ -171,10 +171,6 @@ AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) GNOME_COMPILE_WARNINGS([error]) -AC_ARG_ENABLE(jhbuild-wrapper-script, - AS_HELP_STRING([--enable-jhbuild-wrapper-script],[Make "gnome-shell" script work for jhbuild]),,enable_jhbuild_wrapper_script=no) -AM_CONDITIONAL(USE_JHBUILD_WRAPPER_SCRIPT, test "x$enable_jhbuild_wrapper_script" = xyes) - BROWSER_PLUGIN_DIR="${BROWSER_PLUGIN_DIR:-"\${libdir}/mozilla/plugins"}" AC_ARG_VAR([BROWSER_PLUGIN_DIR],[Where to install the plugin to]) diff --git a/src/Makefile.am b/src/Makefile.am index a5e74b986..e95a5a407 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,23 +33,7 @@ bin_SCRIPTS += gnome-shell-extension-tool gnome-shell-extension-prefs \ gnome-shell-perf-tool EXTRA_DIST += gnome-shell-extension-tool.in gnome-shell-extension-prefs.in \ gnome-shell-perf-tool.in -bin_PROGRAMS = gnome-shell-real - -if USE_JHBUILD_WRAPPER_SCRIPT -gnome_shell = gnome-shell-jhbuild -bin_SCRIPTS += gnome-shell-jhbuild -else -gnome_shell = gnome-shell-real -endif -EXTRA_DIST += gnome-shell-jhbuild.in - -noinst_DATA = gnome-shell -gnome-shell: $(gnome_shell) Makefile - $(AM_V_GEN) cp $< $@.tmp && mv $@.tmp $@ -install-exec-hook: - mv $(DESTDIR)$(bindir)/$(gnome_shell) $(DESTDIR)$(bindir)/gnome-shell -uninstall-hook: - rm -f $(DESTDIR)$(bindir)/gnome-shell +bin_PROGRAMS = gnome-shell generated_script_substitutions = \ -e "s|@bindir[@]|$(bindir)|g" \ @@ -63,11 +47,6 @@ generated_script_substitutions = \ -e "s|@sysconfdir[@]|$(sysconfdir)|g" \ -e "s|@GJS_CONSOLE[@]|$(GJS_CONSOLE)|g" -gnome-shell-jhbuild: gnome-shell-jhbuild.in gnome-shell-real Makefile - $(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@ - @# Regenerate libtool wrapper so Alt+F2 restart will work - @$(LIBTOOL) --mode=execute test -f gnome-shell-real - gnome-shell-extension-tool: gnome-shell-extension-tool.in Makefile $(AM_V_GEN) sed $(generated_script_substitutions) $< > $@.tmp && mv $@.tmp $@ && chmod a+x $@ @@ -185,11 +164,10 @@ libgnome_shell_la_SOURCES = \ libgnome_shell_la_gir_sources = \ $(filter-out %-private.h $(shell_private_sources), $(shell_public_headers_h) $(libgnome_shell_la_SOURCES)) -gnome_shell_real_SOURCES = \ - main.c -gnome_shell_real_CPPFLAGS = $(gnome_shell_cflags) -gnome_shell_real_LDADD = libgnome-shell.la libgnome-shell-js.la $(libgnome_shell_la_LIBADD) -gnome_shell_real_DEPENDENCIES = libgnome-shell.la +gnome_shell_SOURCES = main.c +gnome_shell_CPPFLAGS = $(gnome_shell_cflags) +gnome_shell_LDADD = libgnome-shell.la libgnome-shell-js.la $(libgnome_shell_la_LIBADD) +gnome_shell_DEPENDENCIES = libgnome-shell.la ######################################## diff --git a/src/gnome-shell-jhbuild.in b/src/gnome-shell-jhbuild.in deleted file mode 100755 index 721adb33b..000000000 --- a/src/gnome-shell-jhbuild.in +++ /dev/null @@ -1,175 +0,0 @@ -#!@PYTHON@ -# -*- mode: Python; indent-tabs-mode: nil; -*- - -import optparse -import os -import re -import signal -import subprocess -import sys -import termios - -def show_version(option, opt_str, value, parser): - print "GNOME Shell @VERSION@" - sys.exit() - -def get_running_session_environs(): - wanted_environment = ['DBUS_SESSION_BUS_ADDRESS', 'DISPLAY', 'XDG_DATA_DIRS', - 'XAUTHORITY', 'XDG_SESSION_COOKIE', 'ORBIT_SOCKETDIR', - 'SESSION_MANAGER'] - num_re = re.compile('^[0-9]+$') - myuid = os.getuid() - if not os.path.isdir('/proc'): - return {} - for filename in os.listdir('/proc'): - if not num_re.match(filename): - continue - piddir = '/proc/' + filename - try: - stat = os.stat(piddir) - except OSError, e: - continue - if not stat.st_uid == myuid: - continue - try: - f = open(piddir + "/cmdline") - command = f.read() - f.close() - except IOError, e: - continue - # /proc/cmdline is separated and terminated by NULs - command = command.split("\x00")[0] - command = os.path.basename(command) - if command != 'gnome-session': - continue - try: - f = open(os.path.join(piddir, 'environ')) - except OSError, e: - continue - environ_data = f.read() - f.close() - # There's a trailing null at the last one, so remove the - # empty string - environs = environ_data.split('\0')[:-1] - # Rumor has it the presence of just FOO (instead of FOO=bar) - # represents a deleted environment variable - environs = filter(lambda x: '=' in x, environs) - # Turn it into a dictionary - environs = dict(map(lambda x: x.split('=', 1), environs)) - result = {} - for key in wanted_environment: - if key in environs: - result[key] = environs[key] - return result - -def start_shell(): - self_dir = os.path.dirname(os.path.abspath(sys.argv[0])) - running_from_source_tree = os.path.exists(os.path.join(self_dir, 'gnome-shell-jhbuild.in')) - - # Set up environment - env = dict(os.environ) - if running_from_source_tree: - top_dir = os.path.dirname(self_dir) - - typelib_dir = os.path.join(top_dir, "src") - if 'GI_TYPELIB_PATH' in os.environ: - typelib_dir += ':%s' % (os.environ['GI_TYPELIB_PATH'],) - - env.update({'GI_TYPELIB_PATH' : typelib_dir, - 'GNOME_SHELL_JS' : os.path.join(top_dir, "js"), - 'GNOME_SHELL_DATADIR' : os.path.join(top_dir, "data"), - 'GSETTINGS_SCHEMA_DIR' : os.path.join(top_dir, "data") }) - - args = [] - if options.debug: - debug_command = options.debug_command.split() - if running_from_source_tree: - args += [os.path.join(top_dir, 'libtool'), '--mode=execute'] - args += debug_command - - args.append(os.path.join(self_dir, 'gnome-shell-real')) - if options.replace: - args.append('--replace') - if options.sync: - args.append('--sync') - args += params - return subprocess.Popen(args, env=env) - -def run_shell(): - if options.debug: - # Record initial terminal state so we can reset it to that - # later, in case we kill gdb at a bad time - termattrs = termios.tcgetattr(0); - - normal_exit = False - - if options.verbose: - print "Starting shell" - - shell = None - try: - shell = start_shell() - - # Wait for shell to exit - if options.verbose: - print "Waiting for shell to exit" - shell.wait() - - except KeyboardInterrupt, e: - try: - os.kill(shell.pid, signal.SIGKILL) - except: - pass - shell.wait() - finally: - if shell is None: - print "Failed to start shell" - elif shell.returncode == 0: - normal_exit = True - if options.verbose: - print "Shell exited normally" - elif shell.returncode < 0: - # Python has no mapping for strsignal; not worth using - # ctypes for this. - print "Shell killed with signal %d" % - shell.returncode - else: - # Normal reason here would be losing connection the X server - if options.verbose: - print "Shell exited with return code %d" % shell.returncode - - if options.debug: - termios.tcsetattr(0, termios.TCSANOW, termattrs); - - return normal_exit - -# Main program - -parser = optparse.OptionParser() -parser.add_option("-r", "--replace", action="store_true", - help="Replace the running metacity/gnome-panel") -parser.add_option("-g", "--debug", action="store_true", - help="Run under a debugger") -parser.add_option("", "--debug-command", metavar="COMMAND", - help="Command to use for debugging (defaults to 'gdb --args')") -parser.add_option("-v", "--verbose", action="store_true") -parser.add_option("", "--sync", action="store_true") -parser.add_option("", "--version", action="callback", callback=show_version, - help="Display version and exit") - -options, params = parser.parse_args() - -# Handle ssh logins -if 'DISPLAY' not in os.environ: - running_env = get_running_session_environs() - os.environ.update(running_env) - -if options.debug_command: - options.debug = True -elif options.debug: - options.debug_command = "gdb --args" - -normal_exit = run_shell() -if normal_exit: - sys.exit(0) -else: - sys.exit(1)