diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-04-15 16:34:24 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-04-15 16:34:24 +0200 |
| commit | 7417da2d01b795e585f80a3d778e53c5588653bc (patch) | |
| tree | f7e9fb655fd621097b62b26e3ef51e1655a62d40 | |
| parent | c876c5095673a2f1c0f2c0eef6eadef2ce200e19 (diff) | |
| parent | 5bdb4d5c14598069856034232e0057a4995af8c1 (diff) | |
| download | python-apt-7417da2d01b795e585f80a3d778e53c5588653bc.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
| -rw-r--r-- | apt/package.py | 13 | ||||
| -rw-r--r-- | debian/changelog | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/apt/package.py b/apt/package.py index f12f5559..db5696ae 100644 --- a/apt/package.py +++ b/apt/package.py @@ -513,16 +513,27 @@ 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. + 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. + .. versionadded:: 0.7.9 """ 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. diff --git a/debian/changelog b/debian/changelog index a9518d7d..d356c3cf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,9 @@ python-apt (0.7.11) UNRELEASED; urgency=low * Add support for the Breaks fields * Only create Package objects when they are requested, do not keep them in a dict. Saves 10MB for 25,000 packages on my machine. + * 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 -- Julian Andres Klode <jak@debian.org> Wed, 15 Apr 2009 13:47:42 +0200 |
