diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-12-02 23:17:16 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-12-02 23:17:16 +0000 |
| commit | c89b8408c0115e9fccdd4bfe180e93eb746b12cd (patch) | |
| tree | 3f706c5fe4e3d456cbfe24ebd18063820c28446e /apt | |
| parent | 1aff3d1820f8efe90d811d96c0f5b3806f20d325 (diff) | |
| download | python-apt-c89b8408c0115e9fccdd4bfe180e93eb746b12cd.tar.gz | |
* added "{candidate,installed}Downloadable"
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/package.py | 21 | ||||
| -rw-r--r-- | apt/progress.py | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/apt/package.py b/apt/package.py index 5642496a..5fb6ade7 100644 --- a/apt/package.py +++ b/apt/package.py @@ -21,6 +21,7 @@ import apt_pkg, string, sys, random + class Package(object): """ This class represents a package in the cache """ @@ -89,6 +90,25 @@ class Package(object): return None candidateVersion = property(candidateVersion) + def _downloadable(self, useCandidate=True): + """ helper, return if the version is downloadable """ + if useCandidate: + ver = self._depcache.GetCandidateVer(self._pkg) + else: + ver = self._pkg.CurrentVer + if ver == None: + return False + return ver.Downloadable + def candidateDownloadable(self): + " returns if the canidate is downloadable " + self._downloadable(useCandidate=True) + candidateDownloadable = property(candidateDownloadable) + + def installedDownloadable(self): + " returns if the installed version is downloadable " + self._downloadable(useCandidate=False) + installedDownloadable = property(installedDownloadable) + def sourcePackageName(self): """ Return the source package name as string """ self._lookupRecord() @@ -298,6 +318,7 @@ if __name__ == "__main__": print "Priority (Installed): %s " % pkg.installedPriority print "Installed: %s " % pkg.installedVersion print "Candidate: %s " % pkg.candidateVersion + print "CandiateDownloadable: %s" % pkg.candidateDownloadable print "CandiateOrigin: %s" % pkg.candidateOrigin print "SourcePkg: %s " % pkg.sourcePackageName print "Section: %s " % pkg.section diff --git a/apt/progress.py b/apt/progress.py index 552c9e75..8c47ab95 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -62,6 +62,8 @@ class FetchProgress(object): dlIgnored : "Ignored"} def __init__(self): + self.eta = "" + self.percent = 0.0 pass def start(self): |
