Loading

0001-fix-path-find.patch

  1. --- a/lib/mate-menu.py
  2. +++ b/lib/mate-menu.py
  3. @@ -73,19 +73,6 @@ xdg.Config.setWindowManager('MATE')
  4.  
  5.  from mate_menu.execute import *
  6.  
  7. -def find_on_path(self, command):
  8. -    """Is command on the executable search path?"""
  9. -    if 'PATH' not in os.environ:
  10. -        return False
  11. -    path = os.environ['PATH']
  12. -    for element in path.split(os.pathsep):
  13. -        if not element:
  14. -            continue
  15. -        filename = os.path.join(element, command)
  16. -        if os.path.isfile(filename) and os.access(filename, os.X_OK):
  17. -            return True
  18. -    return False
  19. -
  20.  class MainWindow( object ):
  21.      """This is the main class for the application"""
  22.  
  23. @@ -576,12 +563,14 @@ class MenuWin( object ):
  24.      def createPanelButton( self ):
  25.          self.button_icon = Gtk.Image.new_from_file( self.buttonIcon )
  26.          self.systemlabel = Gtk.Label(label= "%s " % self.buttonText )
  27. -        if find_on_path('lsb_release'):
  28. +        try:
  29.              process = subprocess.Popen(['lsb_release', '-d'], stdout=subprocess.PIPE)
  30.              out, err = process.communicate()
  31.              tooltip = out.replace('Description:', '').strip()
  32.              self.systemlabel.set_tooltip_text(tooltip)
  33.              self.button_icon.set_tooltip_text(tooltip)
  34. +        except FileNotFoundError:
  35. +            pass
  36.  
  37.          if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
  38.              self.button_box = Gtk.HBox()