~nataliabidart/software-center/lost-in-translation

« back to all changes in this revision

Viewing changes to softwarecenter/cmdfinder.py

  • Committer: Kiwinote
  • Date: 2012-03-15 22:36:31 UTC
  • mfrom: (2867 trunk)
  • mto: This revision was merged to the branch mainline in revision 2881.
  • Revision ID: kiwinote@gmail.com-20120315223631-lvea6t5sydpkkqni
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import os
23
23
import logging
24
24
 
25
 
LOG=logging.getLogger(__name__)
 
25
LOG = logging.getLogger(__name__)
 
26
 
26
27
 
27
28
class CmdFinder(object):
28
29
    """ helper class that can find binaries in packages """
29
30
 
30
31
    # standard ubuntu PATH
31
 
    PATH = [ "/usr/local/sbin",
32
 
             "/usr/local/bin",
33
 
             "/usr/sbin",
34
 
             "/usr/bin",
35
 
             "/sbin",
36
 
             "/bin",
37
 
             "/usr/games"
 
32
    PATH = ["/usr/local/sbin",
 
33
            "/usr/local/bin",
 
34
            "/usr/sbin",
 
35
            "/usr/bin",
 
36
            "/sbin",
 
37
            "/bin",
 
38
            "/usr/games",
38
39
           ]
39
40
 
40
41
    def __init__(self, cache):
44
45
    def _is_exec(self, f):
45
46
        return (os.path.dirname(f) in self.PATH and
46
47
                os.path.exists(f) and
47
 
                not os.path.isdir(f) and 
 
48
                not os.path.isdir(f) and
48
49
                os.access(f, os.X_OK))
49
50
 
50
51
    def _get_exec_candidates(self, pkg):
70
71
        cmds = self._get_exec_candidates(pkg)
71
72
        cmds += self._find_alternatives_for_cmds(cmds)
72
73
        return sorted([os.path.basename(p) for p in cmds])
73
 
 
74
 
#~ 
75
 
#~ class CmdFinderWidget(gtk.VBox, CmdFinder):
76
 
#~ 
77
 
    #~ def __init__(self, cache):
78
 
        #~ CmdFinder.__init__(self, cache)
79
 
        #~ return
80
 
#~ 
81
 
    #~ def cmds_from_pkgname(self, pkgname):
82
 
        #~ cmds = CmdFinder.cmds_from_pkgname(self, pkgname)
83
 
        
84