From 251a9c10f4c848df5d1daaef63a16e4ce6d5dc0b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 Mar 2006 18:58:21 +0000 Subject: * added purge option --- apt/package.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index 4fceb904..66bfd72b 100644 --- a/apt/package.py +++ b/apt/package.py @@ -274,10 +274,13 @@ class Package(object): self._pcache.cachePreChange() self._depcache.MarkKeep(self._pkg) self._pcache.cachePostChange() - def markDelete(self, autoFix=True): - """ mark a package for delete. Run the resolver if autoFix is set """ + def markDelete(self, autoFix=True, purge=False): + """ mark a package for delete. Run the resolver if autoFix is set. + Mark the package as purge (remove with configuration) if 'purge' + is set. + """ self._pcache.cachePreChange() - self._depcache.MarkDelete(self._pkg) + self._depcache.MarkDelete(self._pkg, purge) # try to fix broken stuffsta if autoFix and self._depcache.BrokenCount > 0: Fix = apt_pkg.GetPkgProblemResolver(self._depcache) -- cgit v1.2.3 From b47ce124b9672ea58f87dd2380c409566ffcfefd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 May 2006 18:14:35 +0200 Subject: * prepared new upload with cherry picked patch from mainline --- apt/package.py | 11 +++++++---- debian/changelog | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index 66bfd72b..9f329069 100644 --- a/apt/package.py +++ b/apt/package.py @@ -49,7 +49,7 @@ class Package(object): # check if we found a version if ver == None: - #print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) + print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) return False if ver.FileList == None: @@ -149,13 +149,15 @@ class Package(object): def summary(self): """ Return the short description (one line summary) """ - self._lookupRecord() + if not self._lookupRecord(): + return "" return self._records.ShortDesc summary = property(summary) def description(self, format=True): """ Return the formated long description """ - self._lookupRecord() + if not self._lookupRecord(): + return "" desc = "" for line in string.split(self._records.LongDesc, "\n"): tmp = string.strip(line) @@ -168,7 +170,8 @@ class Package(object): def rawDescription(self): """ return the long description (raw)""" - self._lookupRecord() + if not self._lookupRecord(): + return "" return self._records.LongDesc rawDescription = property(rawDescription) diff --git a/debian/changelog b/debian/changelog index 6859407c..9822dc42 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +python-apt (0.6.16.2ubuntu7) dapper; urgency=low + + * apt/package.py: + - check if _lookupRecord() succeeded when checking + maintainer or description (fixes invalid descriptions under + rare circumstances in gnome-app-install) + + -- Michael Vogt Wed, 17 May 2006 18:12:58 +0200 + python-apt (0.6.16.2ubuntu6) dapper; urgency=low * debian/control: -- cgit v1.2.3 From d2a77ae729cfc02263330743f75617c881f1c808 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 May 2006 18:15:00 +0200 Subject: * merged with mainline --- apt/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index 9f329069..d0119b6f 100644 --- a/apt/package.py +++ b/apt/package.py @@ -49,7 +49,7 @@ class Package(object): # check if we found a version if ver == None: - print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) + #print "No version for: %s (Candidate: %s)" % (self._pkg.Name, UseCandidate) return False if ver.FileList == None: -- cgit v1.2.3 From a7af5ff42bdc6cd8d8652f7304926a7b58686c70 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 17 May 2006 19:29:39 +0200 Subject: * cherry picked from main --- apt/package.py | 4 ++-- debian/changelog | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index d0119b6f..dfb74789 100644 --- a/apt/package.py +++ b/apt/package.py @@ -105,12 +105,12 @@ class Package(object): return ver.Downloadable def candidateDownloadable(self): " returns if the canidate is downloadable " - self._downloadable(useCandidate=True) + return self._downloadable(useCandidate=True) candidateDownloadable = property(candidateDownloadable) def installedDownloadable(self): " returns if the installed version is downloadable " - self._downloadable(useCandidate=False) + return self._downloadable(useCandidate=False) installedDownloadable = property(installedDownloadable) def sourcePackageName(self): diff --git a/debian/changelog b/debian/changelog index 9822dc42..bc6f5177 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +python-apt (0.6.16.2ubuntu8) dapper; urgency=low + + * apt/package.py: + - fix return value in {candidate,installed}Downloadable + + -- Michael Vogt Wed, 17 May 2006 19:28:44 +0200 + python-apt (0.6.16.2ubuntu7) dapper; urgency=low * apt/package.py: -- cgit v1.2.3 From 1c878fca17aaa7d8300224e1aed0f13066fe3e84 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Feb 2007 17:11:51 +0100 Subject: * apt/package.py: - handle invalid unicode more gracefully (LP#86215) * rebuild against latest apt --- apt/package.py | 7 ++++++- debian/changelog | 5 ++++- debian/control | 2 +- python/string.cc | 6 ++++-- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index af5dd327..39e2993c 100644 --- a/apt/package.py +++ b/apt/package.py @@ -166,7 +166,12 @@ class Package(object): desc_iter = ver.TranslatedDescription self._records.Lookup(desc_iter.FileList.pop(0)) desc = "" - for line in string.split(unicode(self._records.LongDesc,"utf-8"),"\n"): + try: + s = unicode(self._records.LongDesc,"utf-8") + except UnicodeDecodeError,e: + s = _("Invalid unicode in description for '%s' (%s). " + "Please report.") % (name,e) + for line in string.split(s,"\n"): tmp = string.strip(line) if tmp == ".": desc += "\n" diff --git a/debian/changelog b/debian/changelog index cb818eea..9e0fe1be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,11 @@ python-apt (0.6.20ubuntu6) feisty; urgency=low * aptsources/distro.py: - fix crash in add_source (LP#85806) + * apt/package.py: + - handle invalid unicode more gracefully (LP#86215) + * rebuild against latest apt - -- + -- Michael Vogt Mon, 19 Feb 2007 16:34:52 +0100 python-apt (0.6.20ubuntu5) feisty; urgency=low diff --git a/debian/control b/debian/control index bf1ca1de..b243adb1 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: APT Development Team Uploaders: Matt Zimmerman , Michael Vogt Standards-Version: 3.7.2 XS-Python-Version: all -Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.46.4ubuntu7), apt-utils, python-all-dev, python-distutils-extra, cdbs, python-central (>= 0.5) +Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.46.4ubuntu8), apt-utils, python-all-dev, python-distutils-extra, cdbs, python-central (>= 0.5) Package: python-apt Architecture: any diff --git a/python/string.cc b/python/string.cc index 16adc8cd..d0926da5 100644 --- a/python/string.cc +++ b/python/string.cc @@ -53,9 +53,11 @@ PyObject *StrSizeToStr(PyObject *Self,PyObject *Args) if (PyArg_ParseTuple(Args,"O",&Obj) == 0) return 0; if (PyInt_Check(Obj)) - return CppPyString(SizeToStr(PyInt_AS_LONG(Obj))); + return CppPyString(SizeToStr(PyInt_AsLong(Obj))); + if (PyLong_Check(Obj)) + return CppPyString(SizeToStr(PyLong_AsLong(Obj))); if (PyFloat_Check(Obj)) - return CppPyString(SizeToStr(PyFloat_AS_DOUBLE(Obj))); + return CppPyString(SizeToStr(PyFloat_AsDouble(Obj))); PyErr_SetString(PyExc_TypeError,"Only understand integers and floats"); return 0; -- cgit v1.2.3 From 608943524b167fe6191750b739b0d230b549638c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Mar 2007 15:34:50 +0100 Subject: * fix gettext import (LP#92764) --- apt/package.py | 2 ++ debian/changelog | 1 + 2 files changed, 3 insertions(+) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index fec438c0..1f373ad3 100644 --- a/apt/package.py +++ b/apt/package.py @@ -24,6 +24,8 @@ import sys import random import string +from gettext import gettext as _ + class BaseDependency(object): " a single dependency " def __init__(self, name, rel, ver, pre): diff --git a/debian/changelog b/debian/changelog index 05efcd08..4950be51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ python-apt (0.6.20ubuntu14) feisty; urgency=low * aptsources/distro.py: - fix typo (LP#84009) + * fix gettext import (LP#92764) -- -- cgit v1.2.3 From 6bc3d1c5dd643fd3fd29ec2319cbdef6fe721d25 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 22 Mar 2007 16:01:02 +0100 Subject: * use the correct gettext domain --- apt/package.py | 4 +++- aptsources/distinfo.py | 4 +++- aptsources/distro.py | 4 +++- aptsources/sourceslist.py | 5 ++++- debian/changelog | 6 ++++++ 5 files changed, 19 insertions(+), 4 deletions(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index 1f373ad3..f7a1a8ac 100644 --- a/apt/package.py +++ b/apt/package.py @@ -24,7 +24,9 @@ import sys import random import string -from gettext import gettext as _ +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) class BaseDependency(object): " a single dependency " diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index 261243b4..674c1bf5 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -29,7 +29,9 @@ from os import getenv import ConfigParser import string -from gettext import gettext as _ +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) import re diff --git a/aptsources/distro.py b/aptsources/distro.py index 16fb0dc7..fe9b4d75 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -26,7 +26,9 @@ import gettext import re import os import sys -from gettext import gettext as _ +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) class Distribution: diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 208e6c7d..754e2003 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -32,9 +32,12 @@ import shutil import time import os.path import sys -from gettext import gettext as _ +#from gettext import gettext as _ #import pdb +import gettext +def _(s): return gettext.dgettext("python-apt", s) + #from UpdateManager.Common.DistInfo import DistInfo from distinfo import DistInfo diff --git a/debian/changelog b/debian/changelog index 760812e1..280fc0cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-apt (0.6.20ubuntu15) feisty; urgency=low + + * use the correct gettext domain + + -- Michael Vogt Thu, 22 Mar 2007 15:55:54 +0100 + python-apt (0.6.20ubuntu14) feisty; urgency=low * aptsources/distro.py: -- cgit v1.2.3 From 432e7c203151f1829f2dccb7a9f89290478580b9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 2 Apr 2007 14:17:20 +0200 Subject: * fix error in invalid unicode handler (LP#99753) --- apt/package.py | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'apt/package.py') diff --git a/apt/package.py b/apt/package.py index f7a1a8ac..b82f1aa0 100644 --- a/apt/package.py +++ b/apt/package.py @@ -223,7 +223,7 @@ class Package(object): s = unicode(self._records.LongDesc,"utf-8") except UnicodeDecodeError,e: s = _("Invalid unicode in description for '%s' (%s). " - "Please report.") % (name,e) + "Please report.") % (self.name,e) for line in string.split(s,"\n"): tmp = string.strip(line) if tmp == ".": diff --git a/debian/changelog b/debian/changelog index 2d40777f..2a76e7f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ python-apt (0.6.20ubuntu15) unstable; urgency=low [ Sebastian Heinlein ] * Update the mirror lists from Launchpad * Only include http and ftp servers - LP#99060 + [Michael Vogt] + * fix error in invalid unicode handler (LP#99753) -- Sebastian Heinlein Mon, 02 Apr 2007 00:02:53 +0200 -- cgit v1.2.3