diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-07-30 15:46:11 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-07-30 15:46:11 +0200 |
| commit | 2215d046a10508c0d3950db6d924727b2a2db336 (patch) | |
| tree | cb0183883ecf997f671fa77015d9436673266999 /apt/package.py | |
| parent | 0695e2f15f7a2dd905fd437a72671b9ba9776f17 (diff) | |
| parent | 82166c78d6b21754bdad32ed8a94773a874d528f (diff) | |
| download | python-apt-2215d046a10508c0d3950db6d924727b2a2db336.tar.gz | |
merged from debian-sid
Diffstat (limited to 'apt/package.py')
| -rw-r--r-- | apt/package.py | 16 |
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. |
