summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-08-08 13:27:33 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-08-08 13:27:33 +0000
commit33b997bc26cfdb50e9845ff925d10a2d0fda79e3 (patch)
treec67ce3ed1e529d99c64cb199dea01fd10a2b0836
parente7cdd62f56556f5c96525c1eb2a8bcc16776fa5c (diff)
downloadpython-apt-33b997bc26cfdb50e9845ff925d10a2d0fda79e3.tar.gz
* more "beef" added to the build-depends example
-rwxr-xr-xdoc/examples/build-deps.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py
index c8e8d6af..03c1f4ab 100755
--- a/doc/examples/build-deps.py
+++ b/doc/examples/build-deps.py
@@ -1,10 +1,12 @@
#!/usr/bin/python
+# this is a example how to access the build dependencies of a package
import apt_pkg
import sys
import sets # only needed for python2.3, python2.4 supports this naively
def get_source_pkg(pkg, records, depcache):
+ """ get the source package name of a given package """
version = depcache.GetCandidateVer(pkg)
if not version:
return None
@@ -35,8 +37,21 @@ except KeyError:
sys.exit(1)
all_build_depends = sets.Set()
+# get the build depdends for the package itself
+srcpkg_name = get_source_pkg(base, records, depcache)
+print "srcpkg_name: %s " % srcpkg_name
+if not srcpkg_name:
+ print "Can't find source package for '%s'" % pkg.Name
+srcrec = srcrecords.Lookup(srcpkg_name)
+if srcrec:
+ bd = srcrecords.BuildDepends
+ print "build-depends of the package: %s " % bd
+ for b in bd:
+ all_build_depends.add(b[0])
+
+# calculate the build depends for all dependencies
depends = depcache.GetCandidateVer(base).DependsList
-for dep in depends["Depends"]:
+for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends?
pkg = dep[0].TargetPkg
srcpkg_name = get_source_pkg(pkg, records, depcache)
if not srcpkg_name: