diff options
| author | Michael Vogt <egon@bottom> | 2006-07-25 13:18:15 +0200 |
|---|---|---|
| committer | Michael Vogt <egon@bottom> | 2006-07-25 13:18:15 +0200 |
| commit | d27dee5e4d80f10a8a37cf59e855484c4016e6b1 (patch) | |
| tree | ba77e5230b59ed4a0f55d3d796bd7808b5b12727 | |
| parent | e491706947931c8d67b42a37c9de6f3a08098ac4 (diff) | |
| parent | 71022104cf64547ba54029555799d72e6fb8027f (diff) | |
| download | python-apt-d27dee5e4d80f10a8a37cf59e855484c4016e6b1.tar.gz | |
* merged from mainline
| -rw-r--r-- | apt/cache.py | 8 | ||||
| -rw-r--r-- | apt/package.py | 21 | ||||
| -rw-r--r-- | debian/changelog | 46 | ||||
| -rw-r--r-- | debian/control | 39 | ||||
| -rw-r--r-- | debian/examples | 1 | ||||
| -rwxr-xr-x | debian/rules | 24 | ||||
| -rwxr-xr-x | doc/examples/print_uris.py | 22 | ||||
| -rw-r--r-- | doc/examples/sources.py | 2 |
8 files changed, 101 insertions, 62 deletions
diff --git a/apt/cache.py b/apt/cache.py index 01034cf9..690510e3 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -31,10 +31,14 @@ class Cache(object): dictionary """ - def __init__(self, progress=None): + def __init__(self, progress=None, rootdir=None): self._callbacks = {} self.open(progress) + if rootdir: + apt_pkg.Config.Set("Dir", rootdir) + apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") + def _runCallbacks(self, name): """ internal helper to run a callback """ if self._callbacks.has_key(name): @@ -218,7 +222,7 @@ class Cache(object): def connect(self, name, callback): """ connect to a signal, currently only used for - cache_{post,pre}_changed """ + cache_{post,pre}_{changed,open} """ if not self._callbacks.has_key(name): self._callbacks[name] = [] self._callbacks[name].append(callback) diff --git a/apt/package.py b/apt/package.py index 4fceb904..0d1145ea 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): @@ -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) @@ -287,10 +290,12 @@ class Package(object): Fix.InstallProtect() Fix.Resolve() self._pcache.cachePostChange() - def markInstall(self, autoFix=True): - """ mark a package for install. Run the resolver if autoFix is set """ + def markInstall(self, autoFix=True, autoInst=True): + """ mark a package for install. Run the resolver if autoFix is set, + automatically install required dependencies if autoInst is set + """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg) + self._depcache.MarkInstall(self._pkg, autoInst) # try to fix broken stuff if autoFix and self._depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(self._depcache) diff --git a/debian/changelog b/debian/changelog index effa0191..deb50ab7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,41 @@ +python-apt (0.6.19) unstable; urgency=low + + [ Michael Vogt ] + * doc/examples/print_uris.py: + - added a example to show how the indexfile.ArchiveURI() can be used + with binary packages + + [ Otavio Salvador ] + * apt/cache.py: + - fix commit doc string to also cite the open related callbacks + - allow change of rootdir for APT database loading + - add dh_installexamples in package building Closes: #376014 + + -- Michael Vogt <mvo@debian.org> Tue, 25 Jul 2006 11:45:28 +0200 + +python-apt (0.6.18-0.2) unstable; urgency=low + + * Non-maintainer upload. + * Add ${shlibs:Depends} and ${misc:Depends} (Closes: #377615). + + -- Christoph Berg <myon@debian.org> Tue, 18 Jul 2006 11:39:52 +0200 + +python-apt (0.6.18-0.1) unstable; urgency=high + + * Non-maintainer upload. + * Call dh_pycentral and dh_python before dh_installdeb, to make sure + the dh_pycentral snippets are put into the maintainer scripts; patch from + Sam Morris. (Closes: #376416) + + -- Steinar H. Gunderson <sesse@debian.org> Wed, 12 Jul 2006 23:26:50 +0200 + +python-apt (0.6.18) unstable; urgency=low + + * Non-maintainer upload. + * Update for the new Python policy. Closes: #373512 + + -- Raphael Hertzog <hertzog@debian.org> Sat, 17 Jun 2006 15:09:28 +0200 + python-apt (0.6.17) unstable; urgency=low * apt/progress.py: @@ -9,8 +47,12 @@ python-apt (0.6.17) unstable; urgency=low - fix various pychecker warnings * apt/cache.py: - return useful values on Cache.update() - * apt/cache.py, apt/package.py: fix various pychecker warnings - * apt/cache.py: Release locks on failure (thanks to Colin Watson) + - Release locks on failure (thanks to Colin Watson) + - fix various pychecker warnings + * apt/package.py: + - fix various pychecker warnings + - check if looupRecords succeeded + - fix bug in the return statement of _downloadable() * python/srcrecords.cc: - add "Restart" method - don't run auto "Restart" before performing a Lookup diff --git a/debian/control b/debian/control index 6966077f..5fa1bc83 100644 --- a/debian/control +++ b/debian/control @@ -4,42 +4,17 @@ Priority: optional 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 -Build-Depends: debhelper (>= 5.0), libapt-pkg-dev (>= 0.6.40), apt-utils, python-dev, python2.4-dev, python2.3-dev +XS-Python-Version: all +Build-Depends: debhelper (>= 5.0.37.1), libapt-pkg-dev (>= 0.6.40), apt-utils, python-all-dev, python-central Package: python-apt -Architecture: all -Depends: ${python:Depends} -Priority: optional -Description: Python interface to libapt-pkg - 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: - . - - Access to the APT configuration system - - Access to the APT package information database - - Parsing of Debian package control files, and other files with a - similar structure - -Package: python2.3-apt -Architecture: any -Depends: python2.3, ${shlibs:Depends} -Replaces: python-apt (<< 0.6.11) -Priority: optional -Description: Python interface to libapt-pkg - 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: - . - - Access to the APT configuration system - - Access to the APT package information database - - Parsing of Debian package control files, and other files with a - similar structure - -Package: python2.4-apt Architecture: any -Depends: python2.4, ${shlibs:Depends} -Replaces: python-apt (<< 0.6.11) +Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} 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} +XB-Python-Version: ${python:Versions} Description: Python interface to libapt-pkg The apt-pkg Python interface will provide full access to the internal libapt-pkg structures allowing Python programs to easily perform a diff --git a/debian/examples b/debian/examples new file mode 100644 index 00000000..80a386c8 --- /dev/null +++ b/debian/examples @@ -0,0 +1 @@ +doc/examples/*.py diff --git a/debian/rules b/debian/rules index 584abdf5..ee159b89 100755 --- a/debian/rules +++ b/debian/rules @@ -12,7 +12,7 @@ DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -PYTHON=python2.3 python2.4 +PYTHON=$(shell pyversions -r debian/control) build: build-stamp build-stamp: @@ -38,18 +38,6 @@ clean: # Build architecture-independent files here. binary-indep: DH_OPTIONS=-i binary-indep: build - dh_testdir - dh_testroot - dh_installdocs - dh_installexamples doc/examples/*.py - dh_installchangelogs - dh_compress - dh_fixperms - dh_installdeb - dh_python - dh_gencontrol - dh_md5sums - dh_builddeb # Build architecture-dependent files here. binary-arch: DH_OPTIONS=-a @@ -57,19 +45,21 @@ binary-arch: build dh_testdir dh_testroot dh_clean -k - + for PY in $(PYTHON); do \ - /usr/bin/$$PY setup.py install --prefix=`pwd`/debian/$${PY}-apt/usr; \ + /usr/bin/$$PY setup.py install --prefix=`pwd`/debian/python-apt/usr; \ done - + dh_installdocs dh_installchangelogs + dh_installexamples + dh_pycentral + dh_python dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps - dh_python dh_gencontrol dh_md5sums dh_builddeb diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py new file mode 100755 index 00000000..c8a64223 --- /dev/null +++ b/doc/examples/print_uris.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# +# a example that prints the URIs of all upgradable packages +# + +import apt +import apt_pkg + + +cache = apt.Cache() +upgradable = filter(lambda p: p.isUpgradable, cache) + + +for pkg in upgradable: + pkg._lookupRecord(True) + path = apt_pkg.ParseSection(pkg._records.Record)["Filename"] + cand = pkg._depcache.GetCandidateVer(pkg._pkg) + for (packagefile,i) in cand.FileList: + indexfile = cache._list.FindIndex(packagefile) + if indexfile: + uri = indexfile.ArchiveURI(path) + print uri diff --git a/doc/examples/sources.py b/doc/examples/sources.py index 78913523..c12c6f15 100644 --- a/doc/examples/sources.py +++ b/doc/examples/sources.py @@ -11,5 +11,5 @@ sources = apt_pkg.GetPkgSrcRecords() sources.Restart() while sources.Lookup('hello'): print sources.Package, sources.Version, sources.Maintainer, sources.Section, `sources.Binaries` - #print sources.Files + print sources.Files print sources.Index.ArchiveURI("") |
