-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

tags 343939 + patch
thanks

Hi,

here is a patch that searches the menu command in a default $PATH if it
is not an absolute path.

Regards,
  Bastian
- --
  ,''`.                  Bastian Kleineidam
 : :' :                    GnuPG Schlüssel
 `. `'    gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E
   `-

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDzUuIeBwlBDLsbz4RAo9TAKC4rgeUqBxvqZH998oEIldWD9f/wgCeM0if
7DVXyaZKF8QWXUGicwIipGY=
=JoVX
-----END PGP SIGNATURE-----
--- menu.py.orig        2006-01-17 20:35:48.086363256 +0100
+++ menu.py     2006-01-17 20:49:28.498209528 +0100
@@ -22,10 +22,12 @@
                 self.menu_files[file] = \
                     MenuParser(os.path.join(self.information['dir'], \
                     'unpacked', file[1:]))
+
     def check_paths(self):
         if filter(lambda x: x.startswith('/usr/lib/menu'), \
             self.menu_files.keys()):
             self.signal_error('menu-files-in-usr-lib-menu')
+
     def check_commands(self):
         commands = []
         for menu in self.menu_files.keys():
@@ -36,9 +38,22 @@
             real_cmd = unquoted.split(' ')[0]
             if real_cmd.find('sh') != -1:
                 continue
-            if not os.path.exists(os.path.join(self.information['dir'], \
-                'unpacked', real_cmd[1:])):
+            if os.path.isabs(real_cmd):
+                found = self.check_command(real_cmd[1:])
+            else:
+                found = False
+                for path in ['usr/local/bin/', 'usr/bin/', 'bin/',
+                             'usr/bin/X11/', 'usr/games/']:
+                    if self.check_command(path + real_cmd):
+                        found = True
+                        break
+            if not found:
                 self.signal_error('command-not-exist', [unquoted])
+
+    def check_command (self, cmd):
+        return os.path.exists(os.path.join(self.information['dir'],
+                                           'unpacked', cmd))
+
     def check_section(self):
         sections = {'Apps': ('Databases', 'Editors', 'Education', \
             'Emulators', 'Graphics', 'Hamradio', 'Math', 'Net', \
@@ -62,6 +77,7 @@
                                 [tmp_sect[1]])
                 else:
                     self.signal_error('unknown-menu-section', [tmp_sect[0]])
+
     def check_quoting(self):
         for menu in self.menu_files.keys():
             for stanza in self.menu_files[menu].menu_file:

Reply via email to