]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/distrib/mac/uninstall_wxPython.py
HandlePrintClient shouldn't go above a top-level window
[wxWidgets.git] / wxPython / distrib / mac / uninstall_wxPython.py
index 9900d930ba8113fa83b452765dbea5666e1f93d5..c99d3015350041490f0ddf732805a7748a54cec0 100755 (executable)
@@ -24,8 +24,8 @@ RSRCDIR = "Contents/Resources"
 # /usr, /usr/local, etc.
 PREFIXES = [ '/Library/Python/2.3/',
              '/Library/Python/2.4/',
 # /usr, /usr/local, etc.
 PREFIXES = [ '/Library/Python/2.3/',
              '/Library/Python/2.4/',
-             '/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-pacakges/',
-             '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-pacakges/',
+             '/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/',
+             '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/',
              '/usr/local/lib/',
              ]
 
              '/usr/local/lib/',
              ]
 
@@ -42,25 +42,39 @@ COMMON_FILES = [ '/usr/local/bin/*',
 class AccessError(Exception):
     pass
 
 class AccessError(Exception):
     pass
 
+class ReceiptError(Exception):
+    pass
+
 
 class InstalledReceipt(object):
     def __init__(self, rcptPath):
         self.rcptPath = rcptPath
         self.rsrcPath = os.path.join(rcptPath, RSRCDIR)
 
 class InstalledReceipt(object):
     def __init__(self, rcptPath):
         self.rcptPath = rcptPath
         self.rsrcPath = os.path.join(rcptPath, RSRCDIR)
-        self.bomFile = glob.glob(os.path.join(self.rsrcPath, "*.bom"))[0]
+        bf = glob.glob(os.path.join(self.rsrcPath, "*.bom"))
+        if bf:
+            self.bomFile = bf[0]
+        else:
+            print "WARNING: Unable to find %s/*.bom" % self.rsrcPath
+            raise ReceiptError
         self.findMetaData()
 
 
     def findMetaData(self):
         # TODO: Make this be able to also look at Info.plist files
         self.findMetaData()
 
 
     def findMetaData(self):
         # TODO: Make this be able to also look at Info.plist files
-        infoFile = glob.glob(os.path.join(self.rsrcPath, "*.info"))[0]
-        self.mdata = {}
-        for line in open(infoFile, "r").readlines():
-            line = line.strip()
-            if line and line[0] != '#':
-                ls = line.split()
-                self.mdata[ls[0]] = line[len(ls[0])+1:]
-
+        infoFiles = glob.glob(os.path.join(self.rsrcPath, "*.info"))
+        if infoFiles:
+            # there should be only one
+            infoFile = infoFiles[0]
+            self.mdata = {}
+            for line in open(infoFile, "r").readlines():
+                line = line.strip()
+                if line and line[0] != '#':
+                    ls = line.split()
+                    self.mdata[ls[0]] = line[len(ls[0])+1:]
+        else:
+            print "WARNING: Unable to find %s/*.info" % self.rsrcPath
+            raise ReceiptError
+            
 
     def getFileList(self):
         p = os.popen("lsbom -s %s" % self.bomFile, "r")
 
     def getFileList(self):
         p = os.popen("lsbom -s %s" % self.bomFile, "r")
@@ -155,8 +169,11 @@ class InstalledReceipt(object):
 def findInstalled():
     installed = []
     for name in glob.glob(os.path.join(RCPTDIR, "wxPython*")):
 def findInstalled():
     installed = []
     for name in glob.glob(os.path.join(RCPTDIR, "wxPython*")):
-        ir = InstalledReceipt(name)
-        installed.append(ir)
+        try:
+            ir = InstalledReceipt(name)
+            installed.append(ir)
+        except ReceiptError:
+            pass  # just skip it...
 
     return installed
 
 
     return installed
 
@@ -184,7 +201,7 @@ def main():
         sys.exit()
         
     for i, inst in enumerate(installed):
         sys.exit()
         
     for i, inst in enumerate(installed):
-        print "  %d.  %s \t%s" % (i+1, inst.mdata["Title"], inst.mdata["Version"])
+        print " %2d.  %-40s    %s" % (i+1, inst.mdata["Title"], inst.mdata["Version"])
         
     print 
     ans = raw_input("Enter the number of the install to examine or 'Q' to quit: ")
         
     print 
     ans = raw_input("Enter the number of the install to examine or 'Q' to quit: ")