[or-cvs] r17332: {updater} various fixes. now thandy will loop infinitely because the e (updater/trunk/lib/thandy/packagesys)

nickm at seul.org nickm at seul.org
Thu Nov 20 01:46:57 UTC 2008


Author: nickm
Date: 2008-11-19 20:46:57 -0500 (Wed, 19 Nov 2008)
New Revision: 17332

Modified:
   updater/trunk/lib/thandy/packagesys/ExePackages.py
   updater/trunk/lib/thandy/packagesys/PackageDB.py
   updater/trunk/lib/thandy/packagesys/PackageSystem.py
Log:
various fixes.  now thandy will loop infinitely because the exe file gives a 404.

Modified: updater/trunk/lib/thandy/packagesys/ExePackages.py
===================================================================
--- updater/trunk/lib/thandy/packagesys/ExePackages.py	2008-11-20 01:38:23 UTC (rev 17331)
+++ updater/trunk/lib/thandy/packagesys/ExePackages.py	2008-11-20 01:46:57 UTC (rev 17332)
@@ -8,6 +8,7 @@
 
 class ExePackageSystem(pdb.DBBackedPackageSystem):
     def __init__(self, repo):
+        pdb.DBBackedPackageSystem.__init__(self)
         self._repo = repo
 
     def getName(self):
@@ -31,7 +32,7 @@
                                  [],  # filelist not implemented in this.
                                  rp,
                                  self._repo.getFilename(rp),
-                                 arguments=extra['exe_args'],
+                                 arguments=extra.get('exe_args', []),
                                  registry_ent=extra.get('registry_ent')))
         return handles
 
@@ -44,7 +45,7 @@
 class ExePackageHandle(pdb.DBBackedPackageHandle):
     def __init__(self, packageDB, name, version, filelist, relpath, filename,
                  arguments, registry_ent=None):
-        pdb.DBBackedPackageHandle.__init__(packageDB, name, version, filelist)
+        pdb.DBBackedPackageHandle.__init__(self, packageDB, name, version, filelist)
         self._relPath = relpath
         self._filename = filename
         self._arguments = arguments

Modified: updater/trunk/lib/thandy/packagesys/PackageDB.py
===================================================================
--- updater/trunk/lib/thandy/packagesys/PackageDB.py	2008-11-20 01:38:23 UTC (rev 17331)
+++ updater/trunk/lib/thandy/packagesys/PackageDB.py	2008-11-20 01:46:57 UTC (rev 17332)
@@ -11,7 +11,7 @@
 
 class SimplePackageDB:
     def __init__(self, filename):
-        thandy.util.ensureParent(filename)
+        thandy.util.ensureParentDir(filename)
         self._db = anydbm.open(filename, 'c')
         atexit.register(self.close)
 
@@ -19,18 +19,18 @@
         self._db.close()
 
     def setVersion(self, package, version, filelist):
-        self._db['pv_%s'%package] = (version, filelist)
+        self._db['pv_%s'%str(package)] = (version, filelist)
 
     def setInstallParameters(self, package, params):
-        self._db['ip_%s'%package] = params
+        self._db['ip_%s'%str(package)] = params
 
     def getCurVersion(self, package):
-        v = self._db.get('pv_%s'%package)
+        v = self._db.get('pv_%s'%str(package))
         if v != None:
             return v[0]
 
     def getInstallParameters(self, package):
-        return self._db.get('pi_%s'%package)
+        return self._db.get('pi_%s'%str(package))
 
 class DBBackedPackageSystem(thandy.packagesys.PackageSystem.PackageSystem):
     def __init__(self):
@@ -39,7 +39,7 @@
     def getDB(self):
         if self._packageDB is None:
             fname = thandy.util.userFilename("db/packages")
-            self._packageDB = pdb.PackageDB(fname)
+            self._packageDB = SimplePackageDB(fname)
         return self._packageDB
 
 class DBBackedPackageHandle(thandy.packagesys.PackageSystem.PackageHandle):
@@ -61,7 +61,7 @@
     def getInstalledVersion(self, transaction=None):
         return self._packageDB.getCurVersion(self._name)
 
-    def install(self):
+    def install(self, transaction=None):
         params = self._doInstall()
         self._packageDB.setCurVersion(
             self._name, self._version, self._filelist)
@@ -70,10 +70,10 @@
     def _doInstall(self):
         raise NotImplemented()
 
-    def isInstalled(self):
-        return self.getInstalledVersion(self, transaction) == self._version
+    def isInstalled(self, transaction=None):
+        return self.getInstalledVersion(transaction) == self._version
 
-    def checkInstall(self):
+    def checkInstall(self, transaction=None):
         base = self._getInstallBase()
 
         all_ok = True

Modified: updater/trunk/lib/thandy/packagesys/PackageSystem.py
===================================================================
--- updater/trunk/lib/thandy/packagesys/PackageSystem.py	2008-11-20 01:38:23 UTC (rev 17331)
+++ updater/trunk/lib/thandy/packagesys/PackageSystem.py	2008-11-20 01:46:57 UTC (rev 17332)
@@ -69,6 +69,9 @@
         self._transactions.append(packageHandle.remove)
 
 class PackageHandle:
+    def __init__(self):
+        pass
+
     def getRelativePath(self):
         raise NotImplemented()
 



More information about the tor-commits mailing list