diff options
| author | Sebastian Heinlein <sebi@sebi-laptop> | 2007-03-22 16:09:31 +0100 |
|---|---|---|
| committer | Sebastian Heinlein <sebi@sebi-laptop> | 2007-03-22 16:09:31 +0100 |
| commit | 9e5248060b5b6f8740f5df8bcffdfdf1fc50d4a3 (patch) | |
| tree | 965612d37c30e4971e4ae9ab41fc181ab0bd8235 | |
| parent | 89e6314a71a56fbc7eb5600036bbb957f3b48034 (diff) | |
| parent | 808dfe4f1df81228fc15a18e47cffcc62a830ed6 (diff) | |
| download | python-apt-9e5248060b5b6f8740f5df8bcffdfdf1fc50d4a3.tar.gz | |
* merge with ubuntu
| -rw-r--r-- | apt/cdrom.py | 1 | ||||
| -rw-r--r-- | apt/package.py | 32 | ||||
| -rw-r--r-- | aptsources/distinfo.py | 12 | ||||
| -rw-r--r-- | aptsources/distro.py | 9 | ||||
| -rw-r--r-- | debian/changelog | 296 | ||||
| -rw-r--r-- | debian/compat | 2 | ||||
| -rw-r--r-- | debian/control | 26 | ||||
| -rw-r--r-- | debian/pycompat | 1 | ||||
| -rw-r--r-- | debian/python-apt.install | 2 | ||||
| -rwxr-xr-x | debian/rules | 40 | ||||
| -rw-r--r-- | doc/examples/desc.py | 25 | ||||
| -rw-r--r-- | python/apt_pkgmodule.cc | 1 | ||||
| -rw-r--r-- | python/apt_pkgmodule.h | 1 | ||||
| -rw-r--r-- | python/cache.cc | 69 | ||||
| -rw-r--r-- | python/depcache.cc | 106 |
15 files changed, 571 insertions, 52 deletions
diff --git a/apt/cdrom.py b/apt/cdrom.py index 8d73339c..9d4b62cb 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -1,4 +1,3 @@ - import apt_pkg from progress import CdromProgress diff --git a/apt/package.py b/apt/package.py index 13481be3..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): @@ -200,6 +202,9 @@ class Package(object): """ Return the short description (one line summary) """ if not self._lookupRecord(): return "" + ver = self._depcache.GetCandidateVer(self._pkg) + desc_iter = ver.TranslatedDescription + self._records.Lookup(desc_iter.FileList.pop(0)) return self._records.ShortDesc summary = property(summary) @@ -207,12 +212,17 @@ class Package(object): """ Return the formated long description """ if not self._lookupRecord(): return "" + # get the translated description + ver = self._depcache.GetCandidateVer(self._pkg) + desc_iter = ver.TranslatedDescription + self._records.Lookup(desc_iter.FileList.pop(0)) desc = "" try: - tmp = unicode(self._records.LongDesc) - except UnicodeDecodeError: - tmp = "Invalid unicode in description" - for line in string.split(tmp, "\n"): + 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" @@ -345,10 +355,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) @@ -358,12 +371,13 @@ class Package(object): Fix.InstallProtect() Fix.Resolve() self._pcache.cachePostChange() - def markInstall(self, autoFix=True, autoInst=True): + def markInstall(self, autoFix=True, autoInst=True, fromUser=True): """ mark a package for install. Run the resolver if autoFix is set, automatically install required dependencies if autoInst is set + record it as automatically installed when fromuser is set to false """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg, autoInst) + self._depcache.MarkInstall(self._pkg, autoInst, fromUser) # try to fix broken stuff if autoFix and self._depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(self._depcache) diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index d7289b4b..261243b4 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -91,8 +91,12 @@ class Mirror: def get_repositories_for_proto(self, proto): return filter(lambda r: r.proto == proto, self.repositories) def has_repository(self, proto, dir): - return len(filter(lambda r: (r.proto == proto) and dir in r.dir, - self.repositories)) > 0 + if dir is None: + return False + for r in self.repositories: + if r.proto == proto and dir in r.dir: + return True + return False def get_repo_urls(self): return map(lambda r: r.get_url(self.hostname), self.repositories) def get_location(self): @@ -193,8 +197,8 @@ class DistInfo: mirror_data = filter(match_mirror_line.match, map(string.strip, open(value))) except: - print "ERROR: Failed to read mirror file" - mirrors = [] + print "WARNING: Failed to read mirror file" + mirror_data = [] for line in mirror_data: if line.startswith("#LOC:"): location = match_loc.sub(r"\1", line) diff --git a/aptsources/distro.py b/aptsources/distro.py index ac1b53e7..16fb0dc7 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -164,7 +164,7 @@ class Distribution: new_source = self.sourceslist.add(type, uri, dist, comps, comment) # if source code is enabled add a deb-src line after the new # source - if self.get_source_code == True and tpye == self.binary_type: + if self.get_source_code == True and type == self.binary_type: self.sourceslist.add(self.source_type, uri, dist, comps, comment, file=new_source.file, pos=self.sourceslist.list.index(new_source)+1) @@ -174,7 +174,6 @@ class Distribution: Enable a component in all main, child and source code sources (excluding cdrom based sources) - sourceslist: an aptsource.sources_list comp: the component that should be enabled """ def add_component_only_once(source, comps_per_dist): @@ -427,7 +426,7 @@ def get_distro(): return UbuntuDistribution(id, codename, description, release) elif id == "Debian": - return DebianDistribution(id, codename, description, - release) + return DebianDistribution(id, codename, description, release) else: - return Distribution(id, codename, description, relase) + return Distribution(id, codename, description, release) + diff --git a/debian/changelog b/debian/changelog index cab337f6..760812e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,18 +1,120 @@ -python-apt (0.6.21) unstable; urgency=low +python-apt (0.6.20ubuntu14) feisty; urgency=low + + * aptsources/distro.py: + - fix typo (LP#84009) + * fix gettext import (LP#92764) + * po/*.po: + - make update-po + + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 22 Mar 2007 15:40:37 +0100 + +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 <michael.vogt@ubuntu.com> Wed, 14 Mar 2007 16:38:22 +0100 + +python-apt (0.6.20ubuntu12) feisty; urgency=low * apt/cdrom.py: - - better cdrom handling support - * apt/package.py: - - added candidateDependencies, installedDependencies - - SizeToString supports PyLong too + - fix bug in cdrom __init__ code + * debian/rules: + - added "DH_PYCENTRAL=nomove" + + + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 7 Mar 2007 10:41:00 +0100 + +python-apt (0.6.20ubuntu11) feisty; urgency=low + + * apt/packages.py: + - support candidateDependencies, installedDependencies - support pkg.architecture - support candidateRecord, installedRecord + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 6 Mar 2007 16:22:49 +0100 + +python-apt (0.6.20ubuntu10) feisty; urgency=low + + * debian/control: + - added XS-Vcs-Bzr header to make finding the repo easier * apt/cache.py: - - fix rootdir + - fix rootdir var + + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 1 Mar 2007 14:36:33 +0100 + +python-apt (0.6.20ubuntu9) feisty; urgency=low + + * Re-add debian/python-apt.install (LP: #88134) + - This seems to have gone missing between 0.6.20ubuntu6 and 0.6.20ubuntu8 + - This probably happened because it wasn't added to bzr + + -- Matt Zimmerman <mdz@ubuntu.com> Mon, 26 Feb 2007 14:04:15 -0800 + +python-apt (0.6.20ubuntu8) feisty; urgency=low + + * fix FTBFS + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 26 Feb 2007 18:41:37 +0100 + +python-apt (0.6.20ubuntu7) 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 <michael.vogt@ubuntu.com> Mon, 26 Feb 2007 14:31:00 +0100 + +python-apt (0.6.20ubuntu6) feisty; urgency=low + + * Build the extension for the debug interpreter. + * Set Ubuntu maintainer address. + + -- Matthias Klose <doko@ubuntu.com> Sat, 17 Feb 2007 02:10:37 +0100 + +python-apt (0.6.20ubuntu5) feisty; urgency=low + + * be more robust in has_repository (LP#84897) + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 13 Feb 2007 17:49:55 +0100 + +python-apt (0.6.20ubuntu4) feisty; urgency=low + + * rebuild against latest libapt + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 6 Feb 2007 16:40:37 +0100 + +python-apt (0.6.20ubuntu3) feisty; urgency=low + + * fixes in the new 'aptsources' module + (thanks to Sebastian Heinlein) * apt/cdrom.py: - - fix bug in cdrom mountpoint handling + - better cdrom handling support + * python/string.cc: + - SizeToString supports PyLong too + * apt/cache.py: + - fix rootdir + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 5 Feb 2007 10:29:55 +0100 + +python-apt (0.6.20ubuntu2) feisty; urgency=low + + * python/depcache.cc: + - MarkInstall() has new FromUser argument to support marking + packages as automatically installed + * merged the 'aptsources' module for sources.list handling + (thanks to Sebastian Heinlein) + + -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 2 Feb 2007 16:26:38 +0100 + +python-apt (0.6.20ubuntu1) feisty; urgency=low - -- + * merged from debian + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 19 Dec 2006 13:41:32 +0100 python-apt (0.6.20) unstable; urgency=low @@ -39,10 +141,80 @@ python-apt (0.6.20) unstable; urgency=low * make it build against python2.5 * python/progress.cc: - fix memleak (lp: #43096) + + -- Michael Vogt <mvo@debian.org> Tue, 19 Dec 2006 13:32:11 +0100 + +python-apt (0.6.19ubuntu9.1) edgy-updates; urgency=low + + * protect against not-parsable strings send from dpkg (lp: 68553) + + -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 27 Oct 2006 10:41:44 +0200 + +python-apt (0.6.19ubuntu9) edgy; urgency=low + + * Reupload to restore dependency on python-central. + * debian/rules: Remove dh_python call. + + -- Matthias Klose <doko@ubuntu.com> Thu, 12 Oct 2006 14:26:46 +0200 + +python-apt (0.6.19ubuntu8) edgy; urgency=low - -- Michael Vogt <mvo@debian.org> Tue, 19 Dec 2006 13:32:11 +0100 + * support pkgDepCache::ActionGroup() -python-apt (0.6.19) unstable; urgency=low + -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 6 Oct 2006 18:03:46 +0200 + +python-apt (0.6.19ubuntu7) edgy; urgency=low + + * python/generic.h: + - fix incorrect use of PyMem_DEL(), use PyObject_DEL() + instead. This fixes a nasty segfault with python2.5 + (lp: 63226) + + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 4 Oct 2006 16:45:53 +0200 + +python-apt (0.6.19ubuntu6) edgy; urgency=low + + * python/progress.cc: + - fix memleak (lp: #43096) + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 2 Oct 2006 18:33:44 +0200 + +python-apt (0.6.19ubuntu5) edgy; urgency=low + + * python/pkgmanager.cc: + - fix typo (closes: #382853) + * debian/control: + - tightend dependency (closes: #383478) + * apt/progress.py: + - use os._exit() in the child (lp: #53298) + - use select() when checking for statusfd (lp: #53282) + * acknoledge NMU (closes: #378048, #373512) + * python/apt_pkgmodule.cc: + - fix missing docstring (closes: #368907), + Thanks to Josh Triplett + * make it build against python2.5 + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 18 Sep 2006 18:28:19 +0200 + +python-apt (0.6.19ubuntu4) edgy; urgency=low + + * Rebuild to add support for python2.5. + + -- Matthias Klose <doko@ubuntu.com> Fri, 8 Sep 2006 13:32:47 +0000 + +python-apt (0.6.19ubuntu3) edgy; urgency=low + + * merged ddtp support + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 14 Aug 2006 16:25:51 +0200 + +python-apt (0.6.19ubuntu2) edgy; urgency=low + + * tightened build-deps on latest apt + + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 3 Aug 2006 17:02:30 +0200 + +python-apt (0.6.19ubuntu1) edgy; urgency=low [ Michael Vogt ] * doc/examples/print_uris.py: @@ -50,6 +222,7 @@ python-apt (0.6.19) unstable; urgency=low with binary packages * python/apt_pkgmodule.cc: - export sha256 generation + * added support for the pkgDepCache.IsGarbage() flag [ Otavio Salvador ] * apt/cache.py: @@ -57,7 +230,7 @@ python-apt (0.6.19) unstable; urgency=low - allow change of rootdir for APT database loading - add dh_installexamples in package building Closes: #376014 - -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 26 Jul 2006 18:51:56 +0200 + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 27 Jul 2006 15:00:55 +0200 python-apt (0.6.18-0.2) unstable; urgency=low @@ -84,14 +257,7 @@ python-apt (0.6.18) unstable; urgency=low python-apt (0.6.17) unstable; urgency=low - * apt/progress.py: - - initialize FetchProgress.eta with the correct type - - strip the staus str before passing it to InstallProgress.statusChanged() - - added InstallProgress.statusChange(pkg, percent, status) - - make DumbInstallProgress a new-style class - (thanks to kamion for the suggestions) - - fix various pychecker warnings - * apt/cache.py: + * apt/cache.py: - return useful values on Cache.update() - Release locks on failure (thanks to Colin Watson) - fix various pychecker warnings @@ -109,6 +275,83 @@ python-apt (0.6.17) unstable; urgency=low -- Michael Vogt <mvo@debian.org> Mon, 8 May 2006 22:34:58 +0200 +python-apt (0.6.16.2ubuntu9) edgy; urgency=low + + * rebuild against the latest apt (with auto-mark support) + * the full merge needs a newer python-support + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 3 Jul 2006 21:33:40 +0200 + +python-apt (0.6.16.2ubuntu8) dapper; urgency=low + + * apt/package.py: + - fix return value in {candidate,installed}Downloadable + + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 17 May 2006 19:28:44 +0200 + +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 <michael.vogt@ubuntu.com> Wed, 17 May 2006 18:12:58 +0200 + +python-apt (0.6.16.2ubuntu6) dapper; urgency=low + + * debian/control: + - Replaces: python-apt (<< 0.6.11), instead of Conflicts which is not + correct here. (closes: #308586). + * python/srcrecords.cc: + - don't run auto "Restart" before performing a Lookup (but require + explicit "Restart", fixes the docs/examples/sources.py example) + - fix the initalization (no need to pass a PkgCacheType to the records) + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 8 May 2006 16:40:14 +0200 + +python-apt (0.6.16.2ubuntu5) dapper; urgency=low + + * apt/cache.py: Release locks on failure (thanks to Colin Watson) + (closes: #35867) + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 21 Mar 2006 15:09:14 +0100 + +python-apt (0.6.16.2ubuntu4) dapper; urgency=low + + * apt/package.py: + - added Package.setDelete(purge) option + + -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 6 Mar 2006 18:59:33 +0000 + +python-apt (0.6.16.2ubuntu3) dapper; urgency=low + + * apt/package.py: undo some damager from pychecker + + -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 1 Mar 2006 15:34:23 +0100 + +python-apt (0.6.16.2ubuntu2) dapper; urgency=low + + * apt/progress.py: + - initialize FetchProgress.eta with the correct type + - strip the staus str before passing it to InstallProgress.statusChanged() + * apt/cache.py: + - return useful values on Cache.update() + * fix FTBFS + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 28 Feb 2006 14:07:06 +0100 + +python-apt (0.6.16.2ubuntu1) dapper; urgency=low + + * apt/progress.py: + - added InstallProgress.statusChange(pkg, percent, status) + - make DumbInstallProgress a new-style class + (thanks to kamion for the suggestions) + - fix various pychecker warnings + * apt/cache.py, apt/package.py: fix various pychecker warnings + + -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 28 Feb 2006 12:04:37 +0100 + python-apt (0.6.16.2) unstable; urgency=low * Non-maintainer upload. @@ -120,14 +363,25 @@ python-apt (0.6.16.2) unstable; urgency=low python-apt (0.6.16.1) unstable; urgency=low - * memleak fixed when pkgCache objects are deallocated * typos fixed (thanks to Gustavo Franco) * pkgRecords.Record added to get raw record data * python/cache.cc: "key" in pkgCache::VerIterator.DependsList[key] is - no longer locale specific but always english + no longer locale specific but always englis -- Michael Vogt <mvo@debian.org> Wed, 22 Feb 2006 10:41:13 +0100 +python-apt (0.6.16ubuntu2) dapper; urgency=low + + * Drop python2.3 package. + + -- Matthias Klose <doko@ubuntu.com> Tue, 14 Feb 2006 15:27:26 +0000 + +python-apt (0.6.16ubuntu1) dapper; urgency=low + + * memleak fixed when pkgCache objects are deallocated + + -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 12 Jan 2006 00:08:05 +0100 + python-apt (0.6.16) unstable; urgency=low * added GetPkgAcqFile to queue individual file downloads with the diff --git a/debian/compat b/debian/compat index 7813681f..7ed6ff82 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5
\ No newline at end of file +5 diff --git a/debian/control b/debian/control index 78b9f2a1..2a344320 100644 --- a/debian/control +++ b/debian/control @@ -1,11 +1,13 @@ Source: python-apt Section: python Priority: optional -Maintainer: APT Development Team <deity@lists.debian.org> +Maintainer: Michael Vogt <mvo@ubuntu.com> +XSBC-Original-Maintainer: APT Development Team <deity@lists.debian.org> Uploaders: Matt Zimmerman <mdz@debian.org>, Michael Vogt <mvo@debian.org> -Standards-Version: 3.6.2.0 +Standards-Version: 3.7.2 XS-Python-Version: all -Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.45), apt-utils, python-all-dev, python-central, python-distutils-extra, cdbs +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), python-all-dbg +XS-Vcs-Bzr: http://launchpad.net/~ubuntu-core-dev/python-apt/ubuntu Package: python-apt Architecture: any @@ -14,9 +16,10 @@ Priority: optional Replaces: python2.3-apt (<< 0.6.18), python2.4-apt (<< 0.6.18) Conflicts: python2.3-apt (<< 0.6.18), python2.4-apt (<< 0.6.18) Provides: ${python:Provides} +Suggests: python-apt-dbg XB-Python-Version: ${python:Versions} Description: Python interface to libapt-pkg - The apt-pkg Python interface will provide full access to the internal + The apt_pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a variety of functions, such as: . @@ -25,5 +28,16 @@ Description: Python interface to libapt-pkg - Parsing of Debian package control files, and other files with a similar structure . - Furthermore it provides an abstraction of the sources.list configuration - on the repository and the distro level. + The included 'aptsources' Python interface provides an abstraction of + the sources.list configuration on the repository and the distro level. + +Package: python-apt-dbg +Priority: extra +Architecture: any +Depends: python-dbg, python-apt (= ${Source-Version}), ${shlibs:Depends} +Description: Python interface to libapt-pkg (debug extension) + The apt_pkg Python interface will provide full access to the internal + libapt-pkg structures allowing Python programs to easily perform a + variety of functions. + . + This package contains the extension built for the python debug interpreter. diff --git a/debian/pycompat b/debian/pycompat new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/debian/pycompat @@ -0,0 +1 @@ +2 diff --git a/debian/python-apt.install b/debian/python-apt.install new file mode 100644 index 00000000..3e08ba50 --- /dev/null +++ b/debian/python-apt.install @@ -0,0 +1,2 @@ +debian/tmp/usr/lib/python* +debian/tmp/usr/share/python-apt diff --git a/debian/rules b/debian/rules index 016167d6..33d04a21 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,44 @@ #!/usr/bin/make -f - -DEB_AUTO_CLEANUP_RCS := yes +DEB_AUTO_CLEANUP_RCS := yes DEB_PYTHON_SYSTEM=pycentral -# Add here any variable or target overrides you need +export DH_PYCENTRAL=nomove + +DEB_PYTHON_PACKAGES_EXCLUDE=python-apt-dbg +# Add here any variable or target overrides you need include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk + +PKG=python-apt +DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p') +DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS) + +arch-build:: + rm -rf debian/arch-build + mkdir -p debian/arch-build/$(PKG)-$(DEBVER) + tar -c --exclude=arch-build --no-recursion -f - `bzr inventory` \ + | (cd debian/arch-build/$(PKG)-$(DEBVER);tar xf -) + (cd debian/arch-build/$(PKG)-$(DEBVER) && $(DEB_BUILD_PROG)) + +build/python-apt-dbg:: + set -e; \ + for i in $(cdbs_python_build_versions); do \ + python$$i-dbg ./setup.py build; \ + done + +install/python-apt-dbg:: + for i in $(cdbs_python_build_versions); do \ + python$$i-dbg ./setup.py install --root $(CURDIR)/debian/python-apt-dbg; \ + done + find debian/python-apt-dbg \ + ! -type d ! -name '*_d.so' | xargs rm -f + find debian/python-apt-dbg -depth -empty -exec rmdir {} \; + +binary-predeb/python-apt-dbg:: + rm -rf debian/python-apt-dbg/usr/share/doc/python-apt-dbg + ln -s python-apt debian/python-apt-dbg/usr/share/doc/python-apt-dbg + +clean:: + rm -rf build/lib* build/temp* diff --git a/doc/examples/desc.py b/doc/examples/desc.py new file mode 100644 index 00000000..87b9473b --- /dev/null +++ b/doc/examples/desc.py @@ -0,0 +1,25 @@ + +import apt_pkg + +apt_pkg.init() + +apt_pkg.Config.Set("APT::Acquire::Translation","de") + +cache = apt_pkg.GetCache() +depcache = apt_pkg.GetDepCache(cache) + +pkg = cache["gcc"] +cand = depcache.GetCandidateVer(pkg) +print cand + +desc = cand.TranslatedDescription +print desc +print desc.FileList +(f,index) = desc.FileList.pop(0) + +records = apt_pkg.GetPkgRecords(cache) +records.Lookup((f,index)) +desc = records.LongDesc +print len(desc) +print desc + diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 24d876af..81d16f51 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -431,6 +431,7 @@ static PyMethodDef methods[] = // misc {"GetPkgProblemResolver",GetPkgProblemResolver,METH_VARARGS,"GetDepProblemResolver(DepCache) -> PkgProblemResolver"}, + {"GetPkgActionGroup",GetPkgActionGroup,METH_VARARGS,"GetPkgActionGroup(DepCache) -> PkgActionGroup"}, // Cdrom {"GetCdrom",GetCdrom,METH_VARARGS,"GetCdrom() -> Cdrom"}, diff --git a/python/apt_pkgmodule.h b/python/apt_pkgmodule.h index fe7dfe88..d58f4589 100644 --- a/python/apt_pkgmodule.h +++ b/python/apt_pkgmodule.h @@ -67,6 +67,7 @@ PyObject *GetDepCache(PyObject *Self,PyObject *Args); // pkgProblemResolver extern PyTypeObject PkgProblemResolverType; PyObject *GetPkgProblemResolver(PyObject *Self, PyObject *Args); +PyObject *GetPkgActionGroup(PyObject *Self, PyObject *Args); // cdrom extern PyTypeObject PkgCdromType; diff --git a/python/cache.cc b/python/cache.cc index b6278de0..aa4d9ffc 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -443,6 +443,69 @@ PyTypeObject PackageType = 0, // tp_hash }; /*}}}*/ +// Description Class /*{{{*/ +// --------------------------------------------------------------------- +static PyObject *DescriptionAttr(PyObject *Self,char *Name) +{ + pkgCache::DescIterator &Desc = GetCpp<pkgCache::DescIterator>(Self); + PyObject *Owner = GetOwner<pkgCache::DescIterator>(Self); + + if (strcmp("LanguageCode",Name) == 0) + return PyString_FromString(Desc.LanguageCode()); + else if (strcmp("md5",Name) == 0) + return Safe_FromString(Desc.md5()); + else if (strcmp("FileList",Name) == 0) + { + /* The second value in the tuple is the index of the VF item. If the + user wants to request a lookup then that number will be used. + Maybe later it can become an object. */ + PyObject *List = PyList_New(0); + for (pkgCache::DescFileIterator I = Desc.FileList(); I.end() == false; I++) + { + PyObject *DescFile; + PyObject *Obj; + DescFile = CppOwnedPyObject_NEW<pkgCache::PkgFileIterator>(Owner,&PackageFileType,I.File()); + Obj = Py_BuildValue("Nl",DescFile,I.Index()); + PyList_Append(List,Obj); + Py_DECREF(Obj); + } + return List; + } + PyErr_SetString(PyExc_AttributeError,Name); + return 0; +} + +static PyObject *DescriptionRepr(PyObject *Self) +{ + pkgCache::DescIterator &Desc = GetCpp<pkgCache::DescIterator>(Self); + + char S[300]; + snprintf(S,sizeof(S), + "<pkgCache::Description object: language_code:'%s' md5:'%s' ", + Desc.LanguageCode(), Desc.md5()); + return PyString_FromString(S); +} + +PyTypeObject DescriptionType = +{ + PyObject_HEAD_INIT(&PyType_Type) + 0, // ob_size + "pkgCache::DescIterator", // tp_name + sizeof(CppOwnedPyObject<pkgCache::DescIterator>), // tp_basicsize + 0, // tp_itemsize + // Methods + CppOwnedDealloc<pkgCache::DescIterator>, // tp_dealloc + 0, // tp_print + DescriptionAttr, // tp_getattr + 0, // tp_setattr + 0, // tp_compare + DescriptionRepr, // tp_repr + 0, // tp_as_number + 0, // tp_as_sequence + 0, // tp_as_mapping + 0, // tp_hash +}; + /*}}}*/ // Version Class /*{{{*/ // --------------------------------------------------------------------- @@ -571,6 +634,11 @@ static PyObject *VersionAttr(PyObject *Self,char *Name) return PyString_FromString(Ver.PriorityType()); else if (strcmp("Downloadable", Name) == 0) return Py_BuildValue("b", Ver.Downloadable()); + else if (strcmp("TranslatedDescription", Name) == 0) { + return CppOwnedPyObject_NEW<pkgCache::DescIterator>(Owner, + &DescriptionType, + Ver.TranslatedDescription()); + } #if 0 // FIXME: enable once pkgSourceList is stored somewhere else if (strcmp("IsTrusted", Name) == 0) { @@ -625,6 +693,7 @@ PyTypeObject VersionType = }; /*}}}*/ + // PackageFile Class /*{{{*/ // --------------------------------------------------------------------- static PyObject *PackageFileAttr(PyObject *Self,char *Name) diff --git a/python/depcache.cc b/python/depcache.cc index e8140e2b..94ff708c 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -346,11 +346,13 @@ static PyObject *PkgDepCacheMarkInstall(PyObject *Self,PyObject *Args) PyObject *PackageObj; char autoInst=1; - if (PyArg_ParseTuple(Args,"O!|b",&PackageType,&PackageObj, &autoInst) == 0) + char fromUser=1; + if (PyArg_ParseTuple(Args,"O!|bb",&PackageType,&PackageObj, + &autoInst, &fromUser) == 0) return 0; pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); - depcache->MarkInstall(Pkg, autoInst); + depcache->MarkInstall(Pkg, autoInst, 0, fromUser); Py_INCREF(Py_None); return HandleErrors(Py_None); @@ -370,6 +372,34 @@ static PyObject *PkgDepCacheIsUpgradable(PyObject *Self,PyObject *Args) return HandleErrors(Py_BuildValue("b",state.Upgradable())); } +static PyObject *PkgDepCacheIsGarbage(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); + pkgDepCache::StateCache &state = (*depcache)[Pkg]; + + return HandleErrors(Py_BuildValue("b",state.Garbage)); +} + +static PyObject *PkgDepCacheIsAutoInstalled(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(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<pkgDepCache *>(Self); @@ -507,6 +537,8 @@ static PyMethodDef PkgDepCacheMethods[] = {"IsUpgradable",PkgDepCacheIsUpgradable,METH_VARARGS,"Is pkg upgradable"}, {"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"}, @@ -730,3 +762,73 @@ PyTypeObject PkgProblemResolverType = }; /*}}}*/ + +// pkgActionGroup Class /*{{{*/ +// --------------------------------------------------------------------- + + +static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args) +{ + pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self); + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + ag->release(); + Py_INCREF(Py_None); + return HandleErrors(Py_None); +} + +static PyMethodDef PkgActionGroupMethods[] = +{ + {"release", PkgActionGroupRelease, METH_VARARGS, "release()"}, + {} +}; + + +static PyObject *ActionGroupAttr(PyObject *Self,char *Name) +{ + pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self); + + return Py_FindMethod(PkgActionGroupMethods,Self,Name); +} + + +PyTypeObject PkgActionGroupType = +{ + PyObject_HEAD_INIT(&PyType_Type) + 0, // ob_size + "pkgActionGroup", // tp_name + sizeof(CppOwnedPyObject<pkgDepCache::ActionGroup*>), // tp_basicsize + 0, // tp_itemsize + // Methods + CppOwnedDealloc<pkgDepCache::ActionGroup*>, // tp_dealloc + 0, // tp_print + ActionGroupAttr, // tp_getattr + 0, // tp_setattr + 0, // tp_compare + 0, // tp_repr + 0, // tp_as_number + 0, // tp_as_sequence + 0, // tp_as_mapping + 0, // tp_hash +}; + +PyObject *GetPkgActionGroup(PyObject *Self,PyObject *Args) +{ + PyObject *Owner; + if (PyArg_ParseTuple(Args,"O!",&PkgDepCacheType,&Owner) == 0) + return 0; + + pkgDepCache *depcache = GetCpp<pkgDepCache*>(Owner); + pkgDepCache::ActionGroup *group = new pkgDepCache::ActionGroup(*depcache); + CppOwnedPyObject<pkgDepCache::ActionGroup*> *PkgActionGroupPyObj; + PkgActionGroupPyObj = CppOwnedPyObject_NEW<pkgDepCache::ActionGroup*>(Owner, + &PkgActionGroupType, + group); + HandleErrors(PkgActionGroupPyObj); + + return PkgActionGroupPyObj; + +} + + + /*}}}*/ |
