diff options
| author | Michael Vogt <mvo@debian.org> | 2011-02-18 22:37:34 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@debian.org> | 2011-02-18 22:37:34 +0100 |
| commit | be46a92a5621d2c199792ead5371afb979f32f9c (patch) | |
| tree | 3d4397fc802685b433b1f72cf7067907c4a6540f | |
| parent | 45100d466f6c392758ff2e490cdfee9aae7e55a7 (diff) | |
| parent | 2885341cf3d7a1050be1bf2a45237395a3149feb (diff) | |
| download | python-apt-be46a92a5621d2c199792ead5371afb979f32f9c.tar.gz | |
merged from lp:~mvo/python-apt/mvo
| -rw-r--r-- | apt/cache.py | 2 | ||||
| -rw-r--r-- | apt/debfile.py | 4 | ||||
| -rw-r--r-- | apt/package.py | 2 | ||||
| -rw-r--r-- | apt/progress/base.py | 6 | ||||
| -rw-r--r-- | apt/progress/gtk2.py | 2 | ||||
| -rw-r--r-- | debian/changelog | 14 | ||||
| -rw-r--r-- | debian/control | 4 | ||||
| -rw-r--r-- | debian/python3-apt.install | 4 | ||||
| -rw-r--r-- | doc/source/conf.py | 2 | ||||
| -rw-r--r-- | python/depcache.cc | 30 | ||||
| -rw-r--r-- | tests/old/lock.py | 2 | ||||
| -rwxr-xr-x | utils/migrate-0.8.py | 2 |
12 files changed, 57 insertions, 17 deletions
diff --git a/apt/cache.py b/apt/cache.py index 586df366..4b917236 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -360,7 +360,7 @@ class Cache(object): try: res = self._cache.update(fetch_progress, slist, pulse_interval) - except SystemError, e: + except SystemError as e: raise FetchFailedException(e) if not res and raise_on_error: raise FetchFailedException() diff --git a/apt/debfile.py b/apt/debfile.py index 996a4cb3..86fd221b 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -461,7 +461,7 @@ class DebPackage(object): for pkg in self._need_pkgs: try: self._cache[pkg].mark_install(from_user=False) - except SystemError, e: + except SystemError as e: self._failure_string = _("Cannot install '%s'") % pkg self._cache.clear() return False @@ -543,7 +543,7 @@ class DebPackage(object): # auto-convert to hex try: data = unicode(data, "utf-8") - except Exception, e: + except Exception as e: new_data = _("Automatically converted to printable ascii:\n") new_data += self.to_strish(data) return new_data diff --git a/apt/package.py b/apt/package.py index 475edb76..f16ac2a4 100644 --- a/apt/package.py +++ b/apt/package.py @@ -338,7 +338,7 @@ class Version(object): if not isinstance(dsc, unicode): # Only convert where needed (i.e. Python 2.X) dsc = unicode(dsc, "utf-8") - except UnicodeDecodeError, err: + except UnicodeDecodeError as err: return _("Invalid unicode in description for '%s' (%s). " "Please report.") % (self.package.name, err) diff --git a/apt/progress/base.py b/apt/progress/base.py index 6822b74a..97375431 100644 --- a/apt/progress/base.py +++ b/apt/progress/base.py @@ -211,7 +211,7 @@ class InstallProgress(object): """Update the interface.""" try: line = self.status_stream.readline() - except IOError, err: + except IOError as err: # resource temporarly unavailable is ignored if err.errno != errno.EAGAIN and err.errno != errno.EWOULDBLOCK: print err.strerror @@ -266,7 +266,7 @@ class InstallProgress(object): try: select.select([self.status_stream], [], [], self.select_timeout) - except select.error, (errno_, _errstr): + except select.error as (errno_, _errstr): if errno_ != errno.EINTR: raise @@ -275,7 +275,7 @@ class InstallProgress(object): (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) if pid == self.child_pid: break - except OSError, err: + except OSError as err: if err.errno == errno.ECHILD: break if err.errno != errno.EINTR: diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index acb01eed..9137ef76 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -506,7 +506,7 @@ def _test(): apt_progress.show_terminal(True) try: cache.commit(apt_progress.acquire, apt_progress.install) - except Exception, exc: + except Exception as exc: print >> sys.stderr, "Exception happened:", exc if len(sys.argv) > 1: deb = DebPackage(sys.argv[1], cache) diff --git a/debian/changelog b/debian/changelog index 69356be3..9559587d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,8 +9,18 @@ python-apt (0.7.100.2) UNRELEASED; urgency=low - when using the actiongroup as a contextmanager incref/decref on enter and leave. this should fix the instablity issues that aptdaemon runs into (LP: #691134) - - -- Michael Vogt <mvo@debian.org> Tue, 07 Dec 2010 13:41:07 +0100 + * debian/python3-apt.install: + - fix py3 extension module install location (thanks to + Barry) + * python/depcache.cc: + - provide bindings for new libapt SetCandidateRelease() + * debian/control: + - require new libapt-pkg-dev SetCandidateRelease() + * py3 compatible exception handline + * debian/control: + - bump minimal python version to >= 2.6 + + -- Michael Vogt <mvo@debian.org> Fri, 18 Feb 2011 22:34:09 +0100 python-apt (0.7.100.1) unstable; urgency=low diff --git a/debian/control b/debian/control index 475827e7..a84733d1 100644 --- a/debian/control +++ b/debian/control @@ -4,11 +4,11 @@ Priority: standard Maintainer: APT Development Team <deity@lists.debian.org> Uploaders: Michael Vogt <mvo@debian.org>, Julian Andres Klode <jak@debian.org> Standards-Version: 3.9.1 -XS-Python-Version: >= 2.5 +XS-Python-Version: >= 2.6 X-Python3-Version: >= 3.1 Build-Depends: apt-utils, debhelper (>= 7.3.5), - libapt-pkg-dev (>= 0.8), + libapt-pkg-dev (>= 0.8.11), python-all-dev (>= 2.6.6-3~), python-all-dbg, python3-all-dev (>= 3.1.2-10~), diff --git a/debian/python3-apt.install b/debian/python3-apt.install index 16c3317a..352d102b 100644 --- a/debian/python3-apt.install +++ b/debian/python3-apt.install @@ -1,4 +1,4 @@ -usr/lib/python3*/*/apt_pkg.so -usr/lib/python3*/*/apt_inst.so +usr/lib/python3*/*/apt_pkg*.so +usr/lib/python3*/*/apt_inst*.so usr/lib/python3*/*/*/ usr/lib/python3*/*/*.egg-info diff --git a/doc/source/conf.py b/doc/source/conf.py index 18c8642e..8fbf2c11 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,7 +26,7 @@ if os.path.exists("../../build"): sys.path.insert(0, os.path.abspath(os.path.dirname(apt_pkg_path))) try: import apt_pkg - except ImportError, exc: + except ImportError as exc: # Not the correct version sys.stderr.write('W: Ignoring error %s\n' % exc) sys.path.pop(0) diff --git a/python/depcache.cc b/python/depcache.cc index cfa4f5d6..12c13a73 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -184,6 +184,30 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } +static PyObject *PkgDepCacheSetCandidateRelease(PyObject *Self,PyObject *Args) +{ + bool Success; + PyObject *PackageObj; + PyObject *VersionObj; + const char *target_rel; + std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > Changed; + if (PyArg_ParseTuple(Args,"O!O!s", + &PyPackage_Type, &PackageObj, + &PyVersion_Type, &VersionObj, + &target_rel) == 0) + return 0; + + pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); + pkgCache::VerIterator &I = GetCpp<pkgCache::VerIterator>(VersionObj); + if(I.end()) { + return HandleErrors(PyBool_FromLong(false)); + } + + Success = depcache->SetCandidateRelease(I, target_rel, Changed); + + return HandleErrors(PyBool_FromLong(Success)); +} + static PyObject *PkgDepCacheSetCandidateVer(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); @@ -552,6 +576,12 @@ static PyMethodDef PkgDepCacheMethods[] = {"set_candidate_ver",PkgDepCacheSetCandidateVer,METH_VARARGS, "set_candidate_ver(pkg: apt_pkg.Package, ver: apt_pkg.Version) -> bool\n\n" "Set the candidate version of 'pkg' to 'ver'."}, + {"set_candidate_release",PkgDepCacheSetCandidateRelease,METH_VARARGS, + "set_candidate_release(pkg: apt_pkg.Package, ver: apt_pkg.Version, rel: string) -> bool\n\n" + "Sets not only the candidate version 'ver' for package 'pkg', " + "but walks also down the dependency tree and checks if it is required " + "to set the candidate of the dependency to a version from the given " + "release string 'rel', too."}, // global cache operations {"upgrade",PkgDepCacheUpgrade,METH_VARARGS, diff --git a/tests/old/lock.py b/tests/old/lock.py index d45b3964..f19d3e43 100644 --- a/tests/old/lock.py +++ b/tests/old/lock.py @@ -20,7 +20,7 @@ if __name__ == "__main__": if pid == 0: try: apt_pkg.PkgSystemLock() - except SystemError, s: + except SystemError as s: print "Can't get lock: (error text:\n%s)" % s sys.exit(0) diff --git a/utils/migrate-0.8.py b/utils/migrate-0.8.py index 9f7790f7..555257a9 100755 --- a/utils/migrate-0.8.py +++ b/utils/migrate-0.8.py @@ -202,7 +202,7 @@ def find_occurences(all_old, files): words = defaultdict(lambda: set()) try: node = ast.parse(open(fname, "rU").read(), fname) - except Exception, e: + except Exception as e: print >> sys.stderr, "Ignoring %s: %s" % (fname, e) continue for i in ast.walk(node): |
