summaryrefslogtreecommitdiff
path: root/lib/thandy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thandy')
-rw-r--r--lib/thandy/packagesys/ExePackages.py5
-rw-r--r--lib/thandy/packagesys/PackageDB.py20
-rw-r--r--lib/thandy/packagesys/PackageSystem.py3
3 files changed, 16 insertions, 12 deletions
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()