summaryrefslogtreecommitdiff
path: root/apt/package.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2009-07-30 15:55:55 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2009-07-30 15:55:55 +0200
commitde49263fd994bee687f4c2ceb7cd527f528f991b (patch)
tree2e43aec42673b960468d29d9a0c6b7ed9ea5ad1f /apt/package.py
parent2d5c6093e0d77576da867c2e5e6f42b6b75de37b (diff)
parent2215d046a10508c0d3950db6d924727b2a2db336 (diff)
downloadpython-apt-de49263fd994bee687f4c2ceb7cd527f528f991b.tar.gz
merged from mvo
Diffstat (limited to 'apt/package.py')
-rw-r--r--apt/package.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/apt/package.py b/apt/package.py
index ec88a456..f5bdc47d 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -486,15 +486,25 @@ class Package(object):
def __repr__(self):
return '<Package: name:%r id:%r>' % (self._pkg.Name, self._pkg.ID)
- @property
def candidate(self):
"""Return the candidate version of the package.
-
- :since: 0.7.9"""
+
+ This property is writeable to allow you to set the candidate version
+ of the package. Just assign a Version() object, and it will be set as
+ the candidate version.
+ """
cand = self._pcache._depcache.GetCandidateVer(self._pkg)
if cand is not None:
return Version(self, cand)
+ def __set_candidate(self, version):
+ """Set the candidate version of the package."""
+ self._pcache.cachePreChange()
+ self._pcache._depcache.SetCandidateVer(self._pkg, version._cand)
+ self._pcache.cachePostChange()
+
+ candidate = property(candidate, __set_candidate)
+
@property
def installed(self):
"""Return the currently installed version of the package.