diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-07-30 14:47:59 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-07-30 14:47:59 +0200 |
| commit | 00ebd1e79986dad66829edaf8dc906a4c9d1ab6c (patch) | |
| tree | a3de0f4d1427ac705a8410b4c7f90fbe0e9a5786 /apt | |
| parent | 4e66ff1d8fea8631af4656d824b7d6f94f9486c4 (diff) | |
| download | python-apt-00ebd1e79986dad66829edaf8dc906a4c9d1ab6c.tar.gz | |
apt/package.py: Allow to set the candidate of a package (Closes: #523997)
+ Support assignments to the 'candidate' property of Package objects.
+ Initial patch by Sebastian Heinlein
Diffstat (limited to 'apt')
| -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. |
