From 8c752c6b7e891e6c80557dd3e5f24d0e01fb3c56 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 5 Nov 2015 12:15:26 +0100 Subject: [PATCH] unity: ensure we use python3 for the launch script --- debian/control | 4 ++- debian/rules | 8 ++--- tools/unity.cmake | 75 +++++++++++++++++++++++------------------------ 3 files changed, 42 insertions(+), 45 deletions(-) diff --git a/debian/control b/debian/control index 001962e96..aa7256335 100644 --- a/debian/control +++ b/debian/control @@ -8,6 +8,7 @@ Build-Depends: cmake, dbus-test-runner, dh-migrations, dh-translations (>= 94), + dh-python, google-mock (>= 1.6.0+svn437), gsettings-desktop-schemas-dev, gsettings-ubuntu-schemas (>= 0.0.1+14.04.20140219), @@ -48,6 +49,7 @@ Build-Depends: cmake, libzeitgeist-2.0-dev, pkg-config, python (>= 2.7), + python3 (>= 3.4), python-setuptools, quilt, xserver-xorg-video-dummy, @@ -62,7 +64,7 @@ Package: unity Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - ${python:Depends}, + ${python3:Depends}, libunity-core-6.0-9 (= ${binary:Version}), compiz, compiz-core, compiz-core-abiversion-${coreabiversion}, diff --git a/debian/rules b/debian/rules index 9869be6a7..54e671f91 100755 --- a/debian/rules +++ b/debian/rules @@ -9,10 +9,6 @@ gles2_architectures := armel armhf DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') -# avoid template instance removal (lp:1286284) -export DEB_CXXFLAGS_MAINT_STRIP=-O3 -export DEB_CXXFLAGS_MAINT_APPEND=-O2 - # http://ccache.samba.org/manual.html#_precompiled_headers CCACHE_SLOPPINESS=time_macros @@ -46,7 +42,7 @@ override_dh_install: find debian/tmp/usr/lib -name \*.*a -exec rm {} \; rm -f debian/tmp/usr/share/compiz/networkarearegion.xml rm -f debian/tmp//usr/lib/compiz/libnetworkarearegion.so - rm -rf debian/tmp/usr/share/gconf/schemas/ + rm -rf debian/tmp/usr/share/gconf/schemas/ dh_install --fail-missing override_dh_gencontrol: @@ -64,4 +60,4 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) endif %: - dh $@ --with translations,quilt,python2,migrations --parallel + dh $@ --with translations,quilt,python2,python3,migrations --parallel diff --git a/tools/unity.cmake b/tools/unity.cmake index 15d036856..761cfab13 100755 --- a/tools/unity.cmake +++ b/tools/unity.cmake @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # -*- coding: utf-8 -*- # Copyright (C) 2010 Canonical # @@ -18,7 +18,6 @@ # this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -import glib import glob from optparse import OptionParser import os @@ -58,21 +57,21 @@ def set_unity_env (): '''set variable environnement for unity to run''' os.environ['COMPIZ_CONFIG_PROFILE'] = 'ubuntu' - + if not 'DISPLAY' in os.environ: # take an optimistic chance and warn about it :) - print "WARNING: no DISPLAY variable set, setting it to :0" + print("WARNING: no DISPLAY variable set, setting it to :0") os.environ['DISPLAY'] = ':0' def reset_launcher_icons (): '''Reset the default launcher icon and restart it.''' - subprocess.Popen(["gsettings", "reset" ,"com.canonical.Unity.Launcher" , "favorites"]) + subprocess.Popen(["gsettings", "reset" ,"com.canonical.Unity.Launcher" , "favorites"]) def process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_file): '''launch unity under compiz (replace the current shell in any case)''' - + cli = [] - + if debug_mode > 0: # we can do more check later as if it's in PATH... if not os.path.isfile('/usr/bin/gdb'): @@ -85,7 +84,7 @@ def process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_ sys.exit(1) else: cli.extend(['gdb', '--args']) - + if options.compiz_path: cli.extend([options.compiz_path, '--replace']) else: @@ -95,7 +94,7 @@ def process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_ cli.append("--debug") if args: cli.extend(compiz_args) - + if log_file: cli.extend(['2>&1', '|', 'tee', log_file]) @@ -119,7 +118,7 @@ def process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_ # In this case, we need a string and not a list # FIXME: still some bug with 2>&1 not showing everything before wait() return subprocess.Popen(" ".join(cli), env=dict(os.environ), shell=True) - + def run_unity (verbose, debug, advanced_debug, compiz_path, compiz_args, log_file): '''run the unity shell and handle Ctrl + C''' @@ -130,7 +129,7 @@ def run_unity (verbose, debug, advanced_debug, compiz_path, compiz_args, log_fil unity_instance = process_and_start_unity (verbose, debug_mode, compiz_path, compiz_args, log_file) subprocess.call(["start", "unity-panel-service"]) unity_instance.wait() - except KeyboardInterrupt, e: + except KeyboardInterrupt as e: try: os.kill(unity_instance.pid, signal.SIGKILL) except: @@ -139,31 +138,31 @@ def run_unity (verbose, debug, advanced_debug, compiz_path, compiz_args, log_fil sys.exit(unity_instance.returncode) def reset_to_distro(): - ''' remove all known default local installation path ''' - - # check if we are root, we need to be root - if os.getuid() != 0: - print "Error: You need to be root to remove your local unity installation" - return 1 - error = False - - for filedir in well_known_local_path: - for elem in glob.glob(filedir): - try: - shutil.rmtree(elem) - except OSError, e: - if os.path.isfile(elem) or os.path.islink(elem): - os.remove(elem) - else: - print "ERROR: Cannot remove %s: %s" % (elem, e) - error = True - - if error: - print "See above: some error happened and you should clean them before trying to restart unity" - return 1 - else: - print "Unity local install cleaned, you can now restart unity" - return 0 + ''' remove all known default local installation path ''' + + # check if we are root, we need to be root + if os.getuid() != 0: + print("Error: You need to be root to remove your local unity installation") + return 1 + error = False + + for filedir in well_known_local_path: + for elem in glob.glob(filedir): + try: + shutil.rmtree(elem) + except OSError as e: + if os.path.isfile(elem) or os.path.islink(elem): + os.remove(elem) + else: + print("ERROR: Cannot remove %s: %s" % (elem, e)) + error = True + + if error: + print("See above: some error happened and you should clean them before trying to restart unity") + return 1 + else: + print("Unity local install cleaned, you can now restart unity") + return 0 if __name__ == '__main__': usage = "usage: %prog [options]" @@ -176,7 +175,7 @@ if __name__ == '__main__': parser.add_option("--debug", action="store_true", help="Run unity under gdb and print a backtrace on crash. /!\ Only if devs ask for it.") parser.add_option("--distro", action="store_true", - help="Remove local build if present with default values to return to the package value (this doesn't run unity and need root access)") + help="Remove local build if present with default values to return to the package value (this doesn't run unity and need root access)") parser.add_option("--log", action="store", help="Store log under filename.") parser.add_option("--replace", action="store_true", @@ -184,7 +183,7 @@ if __name__ == '__main__': parser.add_option("--reset", action="store_true", help="Reset is not supported anymore. Deprecated option") parser.add_option("--reset-icons", action="store_true", - help="Reset the default launcher icon.") + help="Reset the default launcher icon.") parser.add_option("-v", "--verbose", action="store_true", help="Get additional debug output from unity.") (options, args) = parser.parse_args()