From fe5f0be5325814bebafed82867cc7b81ce0c82e2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 8 May 2006 16:39:11 +0200 Subject: * merged r189 from mainline --- python/tar.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/tar.cc b/python/tar.cc index 20fb1f5f..22c0327e 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -88,7 +88,7 @@ bool ProcessTar::DoItem(Item &Itm,int &Fd) // --------------------------------------------------------------------- /* */ char *doc_tarExtract = -"tarExtract(File,Func,Comp) -> None" +"tarExtract(File,Func,Comp) -> None\n" "The tar file referenced by the file object File, Func called for each\n" "Tar member. Comp must be the string \"gzip\" (gzip is automatically invoked) \n"; PyObject *tarExtract(PyObject *Self,PyObject *Args) @@ -128,7 +128,7 @@ PyObject *tarExtract(PyObject *Self,PyObject *Args) // --------------------------------------------------------------------- /* */ char *doc_debExtract = -"debExtract(File,Func,Chunk) -> None" +"debExtract(File,Func,Chunk) -> None\n" "The deb referenced by the file object File is examined. The AR member\n" "given by Chunk is treated as a tar.gz and fed through Func like\n" "tarExtract\n"; -- 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 'python') 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 9a97aa02892342fa4fe7e2f8e3bfe314f194ef0e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 14 Mar 2007 16:44:10 +0100 Subject: * python/depache.cc: - properly support isAutoInstalled flag --- debian/changelog | 4 +++- python/depcache.cc | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'python') diff --git a/debian/changelog b/debian/changelog index 974662bc..7e897122 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,10 @@ python-apt (0.6.20ubuntu13) feisty; urgency=low * fix in the duplicated source checking (thanks to Sebastian Heinlein) + * python/depache.cc: + - properly support isAutoInstalled flag - -- + -- Michael Vogt Wed, 14 Mar 2007 16:38:22 +0100 python-apt (0.6.20ubuntu12) feisty; urgency=low diff --git a/python/depcache.cc b/python/depcache.cc index 71e6a2e6..94ff708c 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -386,6 +386,20 @@ static PyObject *PkgDepCacheIsGarbage(PyObject *Self,PyObject *Args) return HandleErrors(Py_BuildValue("b",state.Garbage)); } +static PyObject *PkgDepCacheIsAutoInstalled(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp(PackageObj); + pkgDepCache::StateCache &state = (*depcache)[Pkg]; + + return HandleErrors(Py_BuildValue("b",state.Flags & pkgCache::Flag::Auto)); +} + static PyObject *PkgDepCacheIsNowBroken(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp(Self); @@ -524,6 +538,7 @@ static PyMethodDef PkgDepCacheMethods[] = {"IsNowBroken",PkgDepCacheIsNowBroken,METH_VARARGS,"Is pkg is now broken"}, {"IsInstBroken",PkgDepCacheIsInstBroken,METH_VARARGS,"Is pkg broken on the current install"}, {"IsGarbage",PkgDepCacheIsGarbage,METH_VARARGS,"Is pkg garbage (mark-n-sweep)"}, + {"IsAutoInstalled",PkgDepCacheIsAutoInstalled,METH_VARARGS,"Is pkg marked as auto installed"}, {"MarkedInstall",PkgDepCacheMarkedInstall,METH_VARARGS,"Is pkg marked for install"}, {"MarkedUpgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"}, {"MarkedDelete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"}, -- cgit v1.2.3