diff options
author | Tomás Touceda <chiiph@torproject.org> | 2011-11-01 13:20:49 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@torproject.org> | 2011-11-01 13:20:49 -0300 |
commit | 3e752ddc9435831c5d74181e070ec8c5ba1b714e (patch) | |
tree | 48f899e0c6c6d435b614ac7711a9fb1b33911317 /lib/thandy/packagesys/PackageSystem.py | |
parent | 87470801fdc396b54bf0f7f8bfe73f05431aa080 (diff) |
Make transactions not Thp specific
Diffstat (limited to 'lib/thandy/packagesys/PackageSystem.py')
-rw-r--r-- | lib/thandy/packagesys/PackageSystem.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/thandy/packagesys/PackageSystem.py b/lib/thandy/packagesys/PackageSystem.py index d255bef..b2e66a1 100644 --- a/lib/thandy/packagesys/PackageSystem.py +++ b/lib/thandy/packagesys/PackageSystem.py @@ -121,6 +121,16 @@ def getInstaller(relPath, extra, defaultFormat, package): return installer +def getTransaction(transactionType, packages, alreadyInstalledSet, cacheRoot): + """ Return a transaction from the type transactionType considering + the alreadyInstalledSet and that works in the cacheRoot """ + if transactionType == "thp": + import thandy.packagesys.ThpPackages + return thandy.packagesys.ThpPackages.ThpTransaction(packages, + alreadyInstalledSet, + cacheRoot) + return None + class PackageItem: """Represents a single item from a package.""" def __init__(self, relativePath, checker, installer): @@ -237,4 +247,23 @@ class Installer: "DOCDOC params, manifest" return None, None +class Transaction(object): + """ Abstract base class. A Transaction knows how to install or + remove a bundle. """ + def __init__(self, packages, alreadyInstalled, repoRoot): + self._raw_packages = packages + self._repo_root = repoRoot + self._alreadyInstalled = alreadyInstalled + def isReady(self): + """ Returns True if the transaction is ready to start installing + or removing a bundle. """ + raise NotImplemented() + + def install(self): + """ Installs the packages that belong to this transaction. """ + raise NotImplemented() + + def remove(self): + """ Removes the packages that belong to this transaction. """ + raise NotImplemented() |