Changeset 1345

Show
Ignore:
Timestamp:
05/22/08 03:50:30 (8 months ago)
Author:
astormont
Message:

Wine-Doors installer will now bail if certain deps are not met -- This should reduce the number of orange and cabextract related bug reports

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wine-doors/trunk/setup.py

    r1294 r1345  
    1414        if not os.path.isdir( srcdir + "/" + file ): 
    1515            shutil.copy( srcdir + "/" + file, dstdir + "/" + file ) 
     16 
     17def findmodule( module ): 
     18    try: 
     19        __import__( module ) 
     20        return True 
     21    except: 
     22        return False 
     23 
     24def findexec( executable ): 
     25    if commands.getstatusoutput( "which " + executable )[0] == 0: 
     26        return True 
     27    return False 
    1628 
    1729def copygzip( srcfile, dstfile ): 
     
    122134            print "Performing system install with parameters: " + final + "  " + prefix 
    123135 
     136        # Required deps 
     137        missing_required = [] 
     138 
    124139        # Check deps 
    125140        print "Checking dependencies" 
    126141        print "  wine . . . ", 
    127         if commands.getstatusoutput( "which wine" )[0] == 0
     142        if findexec( "wine" )
    128143            print "Found" 
    129144        else: 
    130145            print "Not found !" 
     146            missing_required.append("wine") 
     147 
    131148        print "  cabextract . . . ", 
    132         if commands.getstatusoutput( "which cabextract" )[0] == 0
     149        if findexec( "cabextract" )
    133150            print "Found" 
    134151        else: 
    135152            print "Not found !" 
     153            missing_required.append("cabextract") 
     154 
    136155        print "  orange . . . ", 
    137         if commands.getstatusoutput( "which orange" )[0] == 0
     156        if findexec( "orange" )
    138157            print "Found" 
    139158        else: 
    140159            print "Not found !" 
     160            missing_required.append("orange") 
     161 
    141162        print "  ps . . . ", 
    142         if commands.getstatusoutput( "which ps" )[0] == 0
     163        if findexec( "ps" )
    143164            print "Found" 
    144165        else: 
    145166            print "Not found !" 
     167            missing_required.append("ps") 
     168 
     169        # Python modules 
    146170        print "  pygtk . . . (python-gtk2)", 
    147         try: 
    148             import gtk, gobject 
     171        if findmodule( "gtk" ) and findmodule( "gobject" ): 
    149172            hasui = True 
    150173            print "Found" 
    151         except
     174        else
    152175            print "Not found" 
    153176            hasui = False 
    154177 
    155178        print "  pycairo . . . (python-cairo)", 
    156         try: 
    157             import cairo 
     179        if findmodule( "cairo" ): 
    158180            hasui = True 
    159181            print "Found" 
    160         except
     182        else
    161183            print "Not found" 
    162184            hasui = False 
    163185 
    164186        print "  rsvg . . . (python-gnome2-desktop)", 
    165         try: 
    166             import rsvg 
     187        if findmodule( "rsvg" ): 
    167188            hasui = True 
    168189            print "Found" 
    169         except
     190        else
    170191            print "Not found" 
    171192            hasui = False 
     193 
     194        if missing_required: 
     195            print 
     196            print "The following dependancies are required to install wine-doors:" 
     197            print missing_required 
     198            sys.exit(1) 
    172199 
    173200        if not hasui: