From 5c1d4c640b94c47ec053c04e3090ecf3dc3145be Mon Sep 17 00:00:00 2001 From: raveit65 Date: Nov 11 2018 12:05:01 +0000 Subject: switch to python3 --- diff --git a/mate-menu.spec b/mate-menu.spec index 932bfc5..6c3ad03 100644 --- a/mate-menu.spec +++ b/mate-menu.spec @@ -3,7 +3,7 @@ Name: mate-menu Version: 18.04.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Advanced Menu for the MATE Desktop Group: System Environment/Shells # mate_menu/keybinding.py use MIT license and the rest is under GPLv2+ @@ -16,24 +16,24 @@ Source0: %url/archive/%{version}.tar.gz#/%{name}-%{version}.tar.xz Patch1: mate-menu_adjust-package-manager.patch Patch2: mate-menu_default-applications.patch +# https://github.com/ubuntu-mate/mate-menu/pull/28 +Patch3: mate_menu_python3-port-18-04.patch BuildRequires: gobject-introspection-devel BuildRequires: intltool -BuildRequires: python2-devel >= 2.7 -BuildRequires: python2-distutils-extra -BuildRequires: python2-setuptools +BuildRequires: python3-devel +BuildRequires: python3-distutils-extra +BuildRequires: python3-setuptools BuildRequires: desktop-file-utils Requires: mate-menus Requires: mozo -Requires: python2-configobj -%if 0%{?fedora} && 0%{?fedora} <= 27 -Requires: python-gobject -%else -Requires: python2-gobject -%endif -Requires: python2-pyxdg -Requires: python2-xlib +Requires: python3-configobj +Requires: python3-gobject +Requires: python3-pyxdg +Requires: python3-xlib +Requires: python3-setproctitle +Requires: python3-unidecode Requires: beesu Requires: mate-panel @@ -51,18 +51,16 @@ Environment. %patch1 -p1 -b .adjust-package-manager %patch2 -p1 -b .default-applications +%patch3 -p1 -b .python3 # xdg-su isn't available in fedora sed -i 's/xdg-su/beesu/g' %{_name}/execute.py -#some python fixes -sed -i 's/#!\/usr\/bin\/env python2/#!\/usr\/bin\/python2/g' lib/%{name}.py -sed -i 's/#!\/usr\/bin\/env python/#!\/usr\/bin\/python2/g' lib/%{name}-config.py %build -%py2_build +%py3_build %install -%py2_install +%py3_install # avoid rpmlint invalid-lc-messages-dir and incorrect-locale-subdir errors rm -rf %{buildroot}%{_datadir}/locale/ber @@ -72,6 +70,12 @@ rm -rf %{buildroot}%{_datadir}/locale/nah/LC_MESSAGES/mate-menu.mo rm -rf %{buildroot}%{_datadir}/locale/zh-Hans/LC_MESSAGES/mate-menu.mo rm -rf %{buildroot}%{_datadir}/locale/zh-Hans/ +# remove non patched files +rm -rf %{buildroot}%{python3_sitelib}/%{_name}/mate-menu-config.py.python3 +rm -rf %{buildroot}%{python3_sitelib}/%{_name}/mate-menu.py.python3 +rm -rf %{buildroot}%{_prefix}/lib/%{name}/mate-menu-config.py.python3 +rm -rf %{buildroot}%{_prefix}/lib/%{name}/mate-menu.py.python3 + %find_lang %{name} @@ -80,8 +84,8 @@ rm -rf %{buildroot}%{_datadir}/locale/zh-Hans/ %license COPYING %{_bindir}/%{name} %{_prefix}/lib/%{name}/ -%{python2_sitelib}/%{_name}/ -%{python2_sitelib}/%{_name}-*-py2.7.egg-info/ +%{python3_sitelib}/%{_name}/ +%{python3_sitelib}/%{_name}-*-py3.*.egg-info/ %{_datadir}/%{name}/ %{_datadir}/glib-2.0/schemas/org.mate.mate-menu*.gschema.xml %{_datadir}/mate-panel/applets/org.mate.panel.MateMenuApplet.mate-panel-applet @@ -90,6 +94,9 @@ rm -rf %{buildroot}%{_datadir}/locale/zh-Hans/ %changelog +* Sun Nov 11 2018 Wolfgang Ulbrich - 18.04.3-2 +- switch to python3 + * Sat Nov 10 2018 Wolfgang Ulbrich - 18.04.3-1 - update to 18.04.3 diff --git a/mate_menu_python3-port-18-04.patch b/mate_menu_python3-port-18-04.patch new file mode 100644 index 0000000..ecc17c8 --- /dev/null +++ b/mate_menu_python3-port-18-04.patch @@ -0,0 +1,740 @@ +diff --git a/lib/mate-menu-config.py b/lib/mate-menu-config.py +index c0faed5..9c6e61a 100755 +--- a/lib/mate-menu-config.py ++++ b/lib/mate-menu-config.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*- + + # Copyright (C) 2007-2014 Clement Lefebvre +@@ -297,7 +297,7 @@ def __init__( self ): + theme_name = self.settings.get ("string", "theme-name") + process = subprocess.Popen(['find', '/usr/share/themes', '-name', 'gtkrc'], stdout=subprocess.PIPE) + out, err = process.communicate() +- themes = out.split("\n") ++ themes = out.decode("utf-8").split("\n") + model = Gtk.ListStore(str, str) + self.builder.get_object("themesCombo").set_model(model) + selected_theme = model.append([_("Desktop theme"), "default"]) +@@ -419,7 +419,7 @@ def getHeadingColor( self ): + return self.gdkRGBAToString( color ) + + def gdkRGBAToString( self, gdkRGBA ): +- return "#%.2X%.2X%.2X" % ( gdkRGBA.red * 256, gdkRGBA.green * 256, gdkRGBA.blue * 256 ) ++ return "#%.2X%.2X%.2X" % ( int(gdkRGBA.red * 256), int(gdkRGBA.green * 256), int(gdkRGBA.blue * 256) ) + + def moveUp( self, upButton ): + +diff --git a/lib/mate-menu.py b/lib/mate-menu.py +index eba9c58..0055121 100755 +--- a/lib/mate-menu.py ++++ b/lib/mate-menu.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*- + + # Copyright (C) 2007-2014 Clement Lefebvre +@@ -24,6 +24,7 @@ + import gc + import gi + import gettext ++import importlib + import os + import subprocess + import sys +@@ -42,8 +43,8 @@ + import xdg.Config + import mate_menu.keybinding as keybinding + import mate_menu.pointerMonitor as pointerMonitor +-except Exception, e: +- print e ++except Exception as e: ++ print(e) + sys.exit(1) + + signal.signal(signal.SIGINT, signal.SIG_DFL) +@@ -193,19 +194,19 @@ def PopulatePlugins( self ): + + for plugin in self.pluginlist: + if plugin in self.plugins: +- print u"Duplicate plugin in list: ", plugin ++ print(u"Duplicate plugin in list: ", plugin) + continue + + if plugin != "newpane": + try: + plugin_module = 'mate_menu.plugins.{plugin}'.format(plugin=plugin) +- exec("from {plugin_module} import pluginclass".format(plugin_module=plugin_module)) ++ MyPluginClass = importlib.import_module(plugin_module) + # If no parameter passed to plugin it is autonomous +- if pluginclass.__init__.func_code.co_argcount == 1: +- MyPlugin = pluginclass() ++ if MyPluginClass.pluginclass.__init__.__code__.co_argcount == 1: ++ MyPlugin = MyPluginClass.pluginclass() + else: + # pass mateMenu and togglebutton instance so that the plugin can use it +- MyPlugin = pluginclass(self, self.toggle) ++ MyPlugin = MyPluginClass.pluginclass(self, self.toggle) + + if not MyPlugin.icon: + MyPlugin.icon = "mate-logo-icon.png" +@@ -217,8 +218,8 @@ def PopulatePlugins( self ): + # ImageBox.add( Image1 ) + # Image1.show() + +- #print u"Loading plugin '" + plugin + "' : sucessful" +- except Exception, e: ++ #print(u"Loading plugin '" + plugin + "' : sucessful") ++ except Exception as e: + MyPlugin = Gtk.EventBox() #Fake class for MyPlugin + MyPlugin.heading = _("Couldn't load plugin:") + " " + plugin + MyPlugin.content_holder = Gtk.EventBox() +@@ -237,7 +238,7 @@ def PopulatePlugins( self ): + MyPlugin.add( MyPlugin.content_holder ) + MyPlugin.width = 270 + MyPlugin.icon = 'mate-logo-icon.png' +- print u"Unable to load " + plugin + " plugin :-(" ++ print(u"Unable to load " + plugin + " plugin :-(") + + + self.panesToColor.append( MyPlugin.content_holder ) +@@ -351,7 +352,7 @@ def loadTheme( self ): + def SetupMateMenuBorder(self): + style = self.window.get_style_context() + styleProvider = Gtk.CssProvider() +- styleProvider.load_from_data(".background { border-width: %dpt; }" % self.borderwidth) ++ styleProvider.load_from_data(b".background { border-width: %dpt; }" % self.borderwidth) + style.add_provider(styleProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + self.border.set_margin_top(self.borderwidth) +@@ -524,11 +525,11 @@ def __init__( self, applet, iid ): + self.keybinder.connect("activate", self.onBindingPress) + self.keybinder.start() + self.settings.connect( "changed::hot-key", self.hotkeyChanged ) +- print "Binding to Hot Key: " + self.hotkeyText +- except Exception, cause: ++ print("Binding to Hot Key: " + self.hotkeyText) ++ except Exception as cause: + self.keybinder = None +- print "** WARNING ** - Keybinder Error" +- print "Error Report :\n", str(cause) ++ print("** WARNING ** - Keybinder Error") ++ print("Error Report :\n", str(cause)) + + self.applet.set_can_focus(False) + +@@ -536,9 +537,9 @@ def __init__( self, applet, iid ): + self.pointerMonitor = pointerMonitor.PointerMonitor() + self.pointerMonitor.connect("activate", self.onPointerOutside) + self.mainwin.window.connect( "realize", self.onRealize ) +- except Exception, cause: +- print "** WARNING ** - Pointer Monitor Error" +- print "Error Report :\n", str(cause) ++ except Exception as cause: ++ print("** WARNING ** - Pointer Monitor Error") ++ print("Error Report :\n", str(cause)) + + def onWindowMap( self, *args ): + self.applet.get_style_context().set_state( Gtk.StateFlags.SELECTED ) +@@ -593,7 +594,7 @@ def createPanelButton( self ): + try: + process = subprocess.Popen(['lsb_release', '-d'], stdout=subprocess.PIPE) + out, err = process.communicate() +- tooltip = out.replace('Description:', '').strip() ++ tooltip = str(out).replace('Description:', '').strip() + self.systemlabel.set_tooltip_text(tooltip) + self.button_icon.set_tooltip_text(tooltip) + except OSError: +diff --git a/mate-menu b/mate-menu +index d46ff1d..f6a8897 100755 +--- a/mate-menu ++++ b/mate-menu +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + + # Copyright (C) 2007-2014 Clement Lefebvre + # Copyright (C) 2015-2016 Martin Wimpress +@@ -37,8 +37,8 @@ if len(sys.argv) > 1: + for path in ("org.mate.mate-menu", "org.mate.mate-menu.plugins.places", + "org.mate.mate-menu.plugins.applications", + "org.mate.mate-menu.plugins.recent", +- "org.mate.mate-menu.plugins.system_management"): +- subprocess.call(['gsettings', 'reset-recursively', path]) ++ "org.mate.mate-menu.plugins.system_management"): ++ subprocess.call(['gsettings', 'reset-recursively', path]) + + config_files = os.path.join(configPath, 'mate-menu') + if os.path.isdir(config_files): +@@ -47,4 +47,4 @@ if len(sys.argv) > 1: + print("All MATE Menu settings are now restored to default") + else: + matemenu = os.path.join('/','usr','lib','mate-menu','mate-menu.py') +- subprocess.call([matemenu]) +\ No newline at end of file ++ subprocess.call([matemenu]) +diff --git a/mate_menu/easybuttons.py b/mate_menu/easybuttons.py +index 2ca4e18..30f4fa3 100644 +--- a/mate_menu/easybuttons.py ++++ b/mate_menu/easybuttons.py +@@ -21,11 +21,12 @@ + import os + import re + import shutil ++import unidecode + import xdg.DesktopEntry + import xdg.Menu + +-from execute import * +-from filemonitor import monitor as filemonitor ++from .execute import * ++from .filemonitor import monitor as filemonitor + from gi.repository import Gtk, Gdk, GLib + from gi.repository import Pango + from gi.repository import GObject +@@ -61,10 +62,10 @@ def createTheme( d ): + contents = frozenset(os.listdir(self.iconDir)) - frozenset(('applications', 'applications.list')) + for fn in contents: + if os.path.isfile(os.path.join(self.iconDir, fn)): +- print "Removing file : " + os.path.join(self.iconDir, fn) ++ print("Removing file : " + os.path.join(self.iconDir, fn)) + os.remove(os.path.join(self.iconDir, fn)) + else: +- print os.path.join(self.iconDir, fn) + " is not a file, skipping delete." ++ print(os.path.join(self.iconDir, fn) + " is not a file, skipping delete.") + + self.defaultTheme.append_search_path(self.iconDir) + +@@ -121,8 +122,8 @@ def getIcon( self, iconName, iconSize ): + image = None + + return image +- except Exception, e: +- print "Exception " + e.__class__.__name__ + ": " + e.message ++ except Exception as e: ++ print("Exception " + e.__class__.__name__ + ": " + e.message) + return None + + def themeChanged( self, theme ): +@@ -162,7 +163,7 @@ def __init__( self, iconName, iconSize, labels = None, buttonWidth = -1, buttonH + + if labels: + for label in labels: +- if isinstance( label, basestring ): ++ if isinstance( label, str ): + self.addLabel( label ) + elif isinstance( label, list ): + self.addLabel( label[0], label[1] ) +@@ -340,8 +341,8 @@ def loadDesktopEntry( self, desktopItem ): + if os.path.exists (self.startupFilePath): + self.startupMonitorId = filemonitor.addMonitor( self.startupFilePath, self.startupFileChanged ) + +- except Exception, e: +- print e ++ except Exception as e: ++ print(e) + self.appName = "" + self.appGenericName = "" + self.appComment = "" +@@ -396,14 +397,8 @@ def filterText( self, text ): + self.show() + return True + +- def strip_accents(self, string): +- value = string +- if isinstance(string, unicode): +- try: +- value = string.encode('UTF8', 'ignore') +- except: +- pass +- return value ++ def strip_accents(self, value): ++ return unidecode.unidecode(value) + + def getTooltip( self ): + tooltip = self.appName +@@ -490,7 +485,7 @@ def onDesktopEntryFileChanged( self ): + base = os.path.basename( self.desktopFile ) + for dir in self.appDirs: + if os.path.exists( os.path.join( dir, base ) ): +- # print os.path.join( dir, base ), self.desktopFile ++ # print(os.path.join( dir, base ), self.desktopFile) + self.loadDesktopEntry( xdg.DesktopEntry.DesktopEntry( os.path.join( dir, base ) ) ) + for child in self.labelBox: + child.destroy() +@@ -540,8 +535,8 @@ def setupLabels( self ): + #appComment = "%s" % (appComment); + appName = "%s" % (appName); + appComment = "%s" % (appComment); +- except Exception, detail: +- print detail ++ except Exception as detail: ++ print(detail) + pass + + if self.showComment and self.appComment != "": +diff --git a/mate_menu/easyfiles.py b/mate_menu/easyfiles.py +index 4e03f43..02b25b0 100644 +--- a/mate_menu/easyfiles.py ++++ b/mate_menu/easyfiles.py +@@ -138,5 +138,5 @@ def WriteDesktopFile(DroppedFile,FileData,ListToAdd): + fileHandle.close() + + WriteListFile(ListToAdd,DroppedFile,"a") +- print "Added to places.list" ++ print("Added to places.list") + """ +diff --git a/mate_menu/execute.py b/mate_menu/execute.py +index 97248a5..9190076 100644 +--- a/mate_menu/execute.py ++++ b/mate_menu/execute.py +@@ -29,7 +29,7 @@ def RemoveArgs(Execline): + elem = elem.replace("'","") + elem = elem.replace("\"", "") + if elem not in Specials: +- print elem ++ print(elem) + NewExecline.append(elem) + return NewExecline + +@@ -42,15 +42,15 @@ def Execute( cmd , commandCwd=None): + if (os.path.exists(tmpCwd)): + cwd = tmpCwd + +- if isinstance( cmd, str ) or isinstance( cmd, unicode): ++ if isinstance( cmd, str ): + if (cmd.find("/home/") >= 0) or (cmd.find("xdg-su") >= 0) or (cmd.find("\"") >= 0): +- print "running manually..." ++ print("running manually...") + try: + os.chdir(cwd) + subprocess.Popen(shlex.split(cmd)) + return True +- except Exception, detail: +- print detail ++ except Exception as detail: ++ print(detail) + return False + cmd = cmd.split() + cmd = RemoveArgs(cmd) +@@ -60,7 +60,7 @@ def Execute( cmd , commandCwd=None): + string = ' '.join(cmd) + subprocess.Popen(shlex.split(string)) + return True +- except Exception, detail: +- print detail ++ except Exception as detail: ++ print(detail) + return False + +diff --git a/mate_menu/filemonitor.py b/mate_menu/filemonitor.py +index d8c5e9d..6ac5919 100644 +--- a/mate_menu/filemonitor.py ++++ b/mate_menu/filemonitor.py +@@ -48,7 +48,7 @@ def addMonitor( self, filename, callback, args = None ): + mId = self.wm.add_watch( filename, mask, rec = True)[filename] + if mId >= 0: + self.callbacks[mId] = ( callback, args ) +- except Exception, detail: ++ except Exception as detail: + mId = 0 + return mId + +diff --git a/mate_menu/keybinding.py b/mate_menu/keybinding.py +index 34778be..b3ab162 100644 +--- a/mate_menu/keybinding.py ++++ b/mate_menu/keybinding.py +@@ -125,7 +125,7 @@ def set_focus_window(self, window = None): + self.grab(self.keytext) + + def get_mask_combinations(self, mask): +- return [x for x in xrange(mask+1) if not (x & ~mask)] ++ return [x for x in range(mask+1) if not (x & ~mask)] + + def idle(self): + self.emit("activate") +diff --git a/mate_menu/plugins/applications.py b/mate_menu/plugins/applications.py +index 28dc693..cc57acd 100644 +--- a/mate_menu/plugins/applications.py ++++ b/mate_menu/plugins/applications.py +@@ -70,16 +70,16 @@ def get_system_item_paths(): + def rel_path(target, base=os.curdir): + + if not os.path.exists(target): +- raise OSError, 'Target does not exist: '+target ++ raise OSError('Target does not exist: ' + target) + + if not os.path.isdir(base): +- raise OSError, 'Base is not a directory or does not exist: '+base ++ raise OSError('Base is not a directory or does not exist: ' + base) + + base_list = (os.path.abspath(base)).split(os.sep) + target_list = (os.path.abspath(target)).split(os.sep) + + for i in range(min(len(base_list), len(target_list))): +- if base_list[i] <> target_list[i]: break ++ if base_list[i] != target_list[i]: break + else: + i += 1 + +@@ -256,8 +256,8 @@ def __init__(self, mateMenuWin, toggleButton): + self.settings.bindGSettingsEntryToVar( "bool", "enable-wikipedia", self, "enablewikipedia" ) + self.settings.bindGSettingsEntryToVar( "bool", "enable-dictionary", self, "enabledictionary" ) + self.settings.bindGSettingsEntryToVar( "bool", "enable-computer", self, "enablecomputer" ) +- except Exception, detail: +- print detail ++ except Exception as detail: ++ print(detail) + self.currentFavCol = 0 + self.favorites = [] + +@@ -310,7 +310,7 @@ def get_panel(self): + self.panel_position = object_schema.get_int("position") + 1 + + def __del__( self ): +- print u"Applications plugin deleted" ++ print(u"Applications plugin deleted") + + def wake (self) : + pass +@@ -731,7 +731,7 @@ def Filter( self, widget, category = None ): + allButton.set_relief( Gtk.ReliefStyle.HALF ) + self.activeFilter = (0, text, widget) + else: +- #print "CATFILTER" ++ #print("CATFILTER") + self.activeFilter = (1, category, widget) + if category == "": + listedDesktopFiles = [] +@@ -1010,8 +1010,8 @@ def add_to_panel(self, widget, desktopEntry): + def delete_from_menu(self, widget, desktopEntry): + try: + os.remove(desktopEntry.desktopFile) +- except Exception, detail: +- print detail ++ except Exception as detail: ++ print(detail) + + def onLaunchApp( self, menu, widget ): + widget.execute() +@@ -1159,7 +1159,7 @@ def favoritesBuildLauncher( self, location ): + try: + ButtonIcon = None + # For Folders and Network Shares +- location = string.join( location.split( "%20" ) ) ++ location = " ".join( location.split( "%20" ) ) + + if location.startswith( "file" ): + ButtonIcon = "mate-fs-directory" +@@ -1196,8 +1196,8 @@ def favoritesBuildLauncher( self, location ): + self.mateMenuWin.setTooltip( favButton, favButton.getTooltip() ) + favButton.type = "location" + return favButton +- except Exception, e: +- print u"File in favorites not found: '" + location + "'", e ++ except Exception as e: ++ print(u"File in favorites not found: '" + location + "'", e) + + return None + +@@ -1247,8 +1247,8 @@ def buildFavorites( self ): + position += 1 + + self.favoritesSave() +- except Exception, e: +- print e ++ except Exception as e: ++ print(e) + + def favoritesPositionOnGrid( self, favorite ): + row = 0 +@@ -1340,7 +1340,7 @@ def favoritesSave( self ): + appListFile.write( favorite.type + "\n" ) + + appListFile.close( ) +- except Exception, e: ++ except Exception as e: + msgDlg = Gtk.MessageDialog( None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, _("Couldn't save favorites. Check if you have write access to ~/.config/mate-menu")+"\n(" + e.__str__() + ")" ) + msgDlg.run(); + msgDlg.destroy(); +@@ -1423,7 +1423,7 @@ def updateBoxes( self, menu_has_changed ): + button.destroy() + del item + except Exception as e: +- print e ++ print(e) + + if addedCategories: + sortedCategoryList = [] +@@ -1432,7 +1432,7 @@ def updateBoxes( self, menu_has_changed ): + self.categoriesBox.remove( item["button"] ) + sortedCategoryList.append( ( str(item["index"]) + item["name"], item["button"] ) ) + except Exception as e: +- print e ++ print(e) + + # Create new category buttons and add the to the list + for item in addedCategories: +@@ -1454,7 +1454,7 @@ def updateBoxes( self, menu_has_changed ): + self.categoryList.append( item ) + sortedCategoryList.append( ( str(item["index"]) + item["name"], item["button"] ) ) + except Exception as e: +- print e ++ print(e) + + sortedCategoryList.sort() + +@@ -1462,7 +1462,7 @@ def updateBoxes( self, menu_has_changed ): + try: + self.categoriesBox.pack_start( item[1], False, False, 0 ) + except Exception as e: +- print e ++ print(e) + + # Find added and removed applications add update the application list + newApplicationList = self.buildApplicationList() +@@ -1534,7 +1534,7 @@ def updateBoxes( self, menu_has_changed ): + else: + launcherNames.append(launcherName) + except Exception as e: +- print e ++ print(e) + + self.rebuildLock = False + +@@ -1570,7 +1570,7 @@ def buildApplicationList( self ): + def find_applications_recursively(app_list, directory, catName): + for item in directory.get_contents(): + if item.get_type() == matemenu.TYPE_ENTRY: +- #print "=======>>> " + str(item.name) + " = " + str(catName) ++ #print("=======>>> " + str(item.name) + " = " + str(catName)) + app_list.append( { "entry": item, "category": catName } ) + elif item.get_type() == matemenu.TYPE_DIRECTORY: + find_applications_recursively(app_list, item, catName) +@@ -1591,7 +1591,7 @@ def find_applications_recursively(app_list, directory, catName): + newApplicationsList.append( { "entry": item, "category": entry.name } ) + #elif entry.get_type() == matemenu.TYPE_ENTRY: + # if not (entry.get_is_excluded() or entry.get_is_nodisplay()): +- # print "=======>>> " + item.name + " = top level" ++ # print("=======>>> " + item.name + " = top level") + # newApplicationsList.append( { "entry": item, "category": "" } ) + + return newApplicationsList +diff --git a/mate_menu/plugins/places.py b/mate_menu/plugins/places.py +index f3807cf..a7db73d 100644 +--- a/mate_menu/plugins/places.py ++++ b/mate_menu/plugins/places.py +@@ -26,7 +26,7 @@ + from mate_menu.easybuttons import * + from mate_menu.easygsettings import EasyGSettings + from mate_menu.execute import Execute +-from urllib import unquote ++from urllib.parse import unquote + + # i18n + gettext.install("mate-menu", "/usr/share/locale") +@@ -191,8 +191,8 @@ def do_standard_places( self ): + tmpdesktopDir = os.path.expandvars(config['XDG_DESKTOP_DIR']) + if os.path.exists(tmpdesktopDir): + desktopDir = tmpdesktopDir +- except Exception, detail: +- print detail ++ except Exception as detail: ++ print(detail) + Button4 = easyButton( "desktop", self.iconsize, [_("Desktop")], -1, -1 ) + Button4.connect("clicked", self.ButtonClicked, "xdg-open \"" + desktopDir + "\"") + Button4.show() + + #FIXME: Check for caja on the path and fall back to xdg-open +diff --git a/mate_menu/plugins/recent.py b/mate_menu/plugins/recent.py +index e770e65..bd222ca 100644 +--- a/mate_menu/plugins/recent.py ++++ b/mate_menu/plugins/recent.py +@@ -207,7 +207,7 @@ def GetRecent(self, *args, **kargs): + FileString=[] + IconString=[] + RecentInfo=self.RecManagerInstance.get_items() +- # print RecentInfo[0].get_icon(Gtk.IconSize.MENU) ++ # print(RecentInfo[0].get_icon(Gtk.IconSize.MENU)) + count=0 + MaxEntries=self.numentries + if self.numentries == -1: +diff --git a/mate_menu/pointerMonitor.py b/mate_menu/pointerMonitor.py +index 5abf8a6..08affac 100644 +--- a/mate_menu/pointerMonitor.py ++++ b/mate_menu/pointerMonitor.py +@@ -81,7 +81,7 @@ def run(self): + else: + self.display.allow_events(X.ReplayPointer, X.CurrentTime) + except Exception as e: +- print "Unexpected error: " + str(e) ++ print("Unexpected error: " + str(e)) + + def stop(self): + self.running = False +diff --git a/setup.py b/setup.py +index 0d742c7..64669b4 100755 +--- a/setup.py ++++ b/setup.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*- + + # Copyright (C) 2015 by Mike Gabriel +@@ -22,7 +22,6 @@ + import sys + + from glob import glob +- + from setuptools import setup + + import DistUtilsExtra.command.build_extra +@@ -54,69 +53,67 @@ def datafilelist(installbase, sourcebase): + return datafileList + + data_files = [ +- ("share/man/man1", +- glob("data/*.1") +- ), +- ("share/glib-2.0/schemas", +- [ +- "data/org.mate.mate-menu.gschema.xml", +- ] + +- glob("data/plugins/org.mate.mate-menu.plugins.*.gschema.xml"), +- ), +- ("share/mate-panel/applets", +- [ +- "data/org.mate.panel.MateMenuApplet.mate-panel-applet", +- ]), +- ("share/dbus-1/services", +- [ +- "data/org.mate.panel.applet.MateMenuAppletFactory.service", +- ]), +- ("share/mate-menu", +- [ +- "data/mate-menu.glade", +- "data/mate-menu-config.glade", +- "data/popup.xml", +- "data/applications.list", +- ]), +- ("share/mate-menu/plugins", +- [ +- "data/plugins/applications.glade", +- "data/plugins/system_management.glade", +- "data/plugins/places.glade", +- "data/plugins/recent.glade", +- "mate_menu/plugins/applications.py", +- "mate_menu/plugins/system_management.py", +- "mate_menu/plugins/places.py", +- "mate_menu/plugins/recent.py", +- ]), +- ("share/mate-menu/icons", +- [ +- "data/icons/mate-logo.svg", +- "data/icons/dictionary.png", +- ]), +- ("share/mate-menu/icons/search_engines", +- [ +- "data/icons/ddg.png", +- "data/icons/google.png", +- "data/icons/wikipedia.png", +- ]), +- ("lib/mate-menu", +- glob("lib/*.py*"), +- ), ++ ("share/man/man1".format(prefix=sys.prefix), glob("data/*.1")), ++ ("share/glib-2.0/schemas".format(prefix=sys.prefix), ++ [ ++ "data/org.mate.mate-menu.gschema.xml" ++ ] + glob("data/plugins/org.mate.mate-menu.plugins.*.gschema.xml"), ++ ), ++ ("share/mate-panel/applets".format(prefix=sys.prefix), ++ [ ++ "data/org.mate.panel.MateMenuApplet.mate-panel-applet", ++ ] ++ ), ++ ("share/dbus-1/services".format(prefix=sys.prefix), ++ [ ++ "data/org.mate.panel.applet.MateMenuAppletFactory.service", ++ ] ++ ), ++ ("share/mate-menu".format(prefix=sys.prefix), ++ [ ++ "data/mate-menu.glade", ++ "data/mate-menu-config.glade", ++ "data/popup.xml", ++ "data/applications.list", ++ ] ++ ), ++ ("share/mate-menu/plugins".format(prefix=sys.prefix), ++ [ ++ "data/plugins/applications.glade", ++ "data/plugins/system_management.glade", ++ "data/plugins/places.glade", ++ "data/plugins/recent.glade", ++ "mate_menu/plugins/applications.py", ++ "mate_menu/plugins/system_management.py", ++ "mate_menu/plugins/places.py", ++ "mate_menu/plugins/recent.py", ++ ] ++ ), ++ ("share/mate-menu/icons".format(prefix=sys.prefix), ++ [ ++ "data/icons/mate-logo.svg", ++ "data/icons/dictionary.png", ++ ] ++ ), ++ ("share/mate-menu/icons/search_engines".format(prefix=sys.prefix), ++ [ ++ "data/icons/ddg.png", ++ "data/icons/google.png", ++ "data/icons/wikipedia.png", ++ ] ++ ), ++ ("lib/mate-menu".format(prefix=sys.prefix), glob("lib/*.py*")), + ] + data_files.extend(datafilelist("share/locale", 'build/mo')) + + if sys.argv[1] == "build": + import compileall + compileall.compile_dir("lib") +-elif sys.argv[1] in ("install", "uninstall"): +- # Enforce "/usr" prefix. +- sys.argv += ["--prefix", "/usr"] + +-cmdclass ={ +- "build" : DistUtilsExtra.command.build_extra.build_extra, +- "build_i18n" : DistUtilsExtra.command.build_i18n.build_i18n, +- "clean": DistUtilsExtra.command.clean_i18n.clean_i18n, ++cmdclass = { ++ "build" : DistUtilsExtra.command.build_extra.build_extra, ++ "build_i18n" : DistUtilsExtra.command.build_i18n.build_i18n, ++ "clean": DistUtilsExtra.command.clean_i18n.clean_i18n, + } + + setup( +@@ -125,13 +122,14 @@ def datafilelist(installbase, sourcebase): + description = "An advanced menu for MATE. Supports filtering, favorites, autosession, and many other features.", + license = 'GPLv2+', + author = 'Martin Wimpress', +- url = 'https://bitbucket.org/ubuntu-mate/mate-menu/', ++ url = 'https://github.com/ubuntu-mate/mate-menu/', + packages = [ 'mate_menu', 'mate_menu.plugins', ], +- package_dir = { +- '': '.', +- }, ++ # package_dir = { ++ # '': '.', ++ # }, + data_files = data_files, +- install_requires = [ 'setuptools', ], +- scripts = ['mate-menu'], ++ install_requires = [ 'setuptools', 'configobj', 'unidecode' ], ++ scripts = [ 'mate-menu' ], + cmdclass = cmdclass, ++ zip_safe = True, + ) +