From feed9fd1ef9183cc81a199627e092a6eec207ace Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 20 Nov 2008 01:46:57 +0000 Subject: various fixes. now thandy will loop infinitely because the exe file gives a 404. git-svn-id: file:///home/or/svnrepo/updater/trunk@17332 55e972cd-5a19-0410-ae62-a4d7a52db4cd --- lib/thandy/packagesys/ExePackages.py | 5 +++-- lib/thandy/packagesys/PackageDB.py | 20 ++++++++++---------- lib/thandy/packagesys/PackageSystem.py | 3 +++ 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/thandy/packagesys/ExePackages.py b/lib/thandy/packagesys/ExePackages.py index 88e7722..096e51f 100644 --- a/lib/thandy/packagesys/ExePackages.py +++ b/lib/thandy/packagesys/ExePackages.py @@ -8,6 +8,7 @@ import thandy.packagesys.PackageDB as pdb class ExePackageSystem(pdb.DBBackedPackageSystem): def __init__(self, repo): + pdb.DBBackedPackageSystem.__init__(self) self._repo = repo def getName(self): @@ -31,7 +32,7 @@ class ExePackageSystem(pdb.DBBackedPackageSystem): [], # 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 ExePackageSystem(pdb.DBBackedPackageSystem): 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 diff --git a/lib/thandy/packagesys/PackageDB.py b/lib/thandy/packagesys/PackageDB.py index d4070bf..2f261b0 100644 --- a/lib/thandy/packagesys/PackageDB.py +++ b/lib/thandy/packagesys/PackageDB.py @@ -11,7 +11,7 @@ import thandy.packagesys.PackageSystem 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 @@ class SimplePackageDB: 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 @@ class DBBackedPackageSystem(thandy.packagesys.PackageSystem.PackageSystem): 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 @@ class DBBackedPackageHandle(thandy.packagesys.PackageSystem.PackageHandle): 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 @@ class DBBackedPackageHandle(thandy.packagesys.PackageSystem.PackageHandle): 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 diff --git a/lib/thandy/packagesys/PackageSystem.py b/lib/thandy/packagesys/PackageSystem.py index 784de2d..fa0d28b 100644 --- a/lib/thandy/packagesys/PackageSystem.py +++ b/lib/thandy/packagesys/PackageSystem.py @@ -69,6 +69,9 @@ class PackageTransaction: self._transactions.append(packageHandle.remove) class PackageHandle: + def __init__(self): + pass + def getRelativePath(self): raise NotImplemented() -- cgit v1.2.3